Fork of cakejs2 with improvements
|
2 年之前 | |
---|---|---|
contrib | 2 年之前 | |
examples | 8 年之前 | |
lib | 3 年之前 | |
tests | 8 年之前 | |
.eslintrc.json | 8 年之前 | |
.gitignore | 8 年之前 | |
.travis.yml | 8 年之前 | |
LICENSE | 8 年之前 | |
README.md | 2 年之前 | |
index.js | 8 年之前 | |
package.json | 3 年之前 |
CakeJS2
is a lightweight front-end framework which borrows most awesome features from others.
For example: a candle counter recipe:
create().route('/', 'counter');
Cream.extend({
_namespace : 'counter',
candles : 0,
increment : function() {
this.set('candles', this.candles + 1);
},
render : function() {
return h('button', { onClick : this.increment }, 'Candles on the Cake: ' + this.candles);
}
});
Hyperscript is an requirement:
/** @jsx h */
More examples
Live demos:
Check out examples folder.
Installation
To install latest version, the repository archive could be used:
https://notabug.org/hofuku/cakejs2/archive/master.zip
CDN
None yet
Deprecated:
https://unpkg.com/cakejs2@latest/dist/cake.min.js
API
h
create
Cream
create
options:
create({
element : document.body // by default
elementClass : cake
elementId : cake
createRoot : false // do not create root node, use render's
route
:
create().route(
'/posts/:id/post', // URL pattern, also available "*" pattern
'home' // Namespace of the component
);
Namespaces
Cream is a base component of a cake.
Functions:
init
willTransition
didTransition
render
Options:
_namespsace
- object's namespace_after
- DI afterZefir:
props
- routing options ( /:id/
for an instance became props.id
)params
- params eg ?iam=param
bacame params.iam
Sugar:
observes
property
- computed propertyobserves
creates observer function
dataWatcher : function() { .... }.observes('posts', /^store/)
Cakejs2
is a second generation of the cakejs
framework origincakejs
were made and published in 2014th.MIT License
Copyright (c) 2016 Svetlana Linuxenko