1.2.0 • Published 10 years ago

cheftjs v1.2.0

Weekly downloads
3
License
ISC
Repository
github
Last release
10 years ago

Alt text

cheftjs

是基于 riot.js 薄封装的一套类 flux 框架

||=====================||      
||     Application     ||
||=====================||
||        Router       ||
||=====================||
Tag   -->  do  -->   on
  \        |         /
   \     Store      /
    \______________/
          <--

Application

var c = require('cheftjs');
var app = new c.Applicaton({
    router: require('./router.js')
});    

Router - like backbone

module.exports = {
    routes: {
        '': 'home'
    },
    home: function() {

    }
}

Tag - base on riot

<test>
    <script></script>
    <h1>{result}</h1>
    <button onclick={clickMe}>test</button>
</test>

do

module.exports = {
    do: {
        clickMe: function() {
            this.result = 'click success!';
            this.trigger('clicked');
        }
    }
}

Store

module.exports = {
    store: ''
}

or

module.exports = {
    store: {
        url: '',
        contentType: ''
    }
}

method

  • get()
  • save()
  • del()
  • post()
  • put()

on

module.exports = {
    on: {
        init:    function() {}
        mount:   function() {}
        update:  function() {}
        updated: function() {}
        geted  : function(data, status) {}
        posted : function(data, status) {}
        puted  : function(data, status) {}
        saved  : function(data, status) {}
        deleted: function(data, status) {}
        
        clicked : function() {
            console.log('the tag can auto update');
        }
    }
}

Demo

cd demo
npm install
gulp

Alt text

Project

Alt text

1.2.0

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago