CakeJS2
is a lightweight front-end framework which borrows most awesome features from others.
- Virtual-dom merged into a source tree
- No dependencies
- SVG support (partial)
- All in one
- Dependency management
- Live rendering (+ virtual dom)
- Good performance
- JSX support
- Small error stack trace (?)
- Small size and codebase (about 23kb)
- ES5 support (Yeah!)
- Extremely easy to learn
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
- next
- register
- unregister
- inject
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 after
Zefir:
props
- routing options (/:id/
for an instance becameprops.id
)params
- params eg?iam=param
bacameparams.iam
Sugar:
observes
property
- computed property
observes
creates observer function
dataWatcher : function() { .... }.observes('posts', /^store/)
- [2022] Forked to became a general development version for now. notabug
- [2016]
Cakejs2
is a second generation of thecakejs
framework origin - [2012] First version of
cakejs
were made and published in 2014th.
MIT License
Copyright (c) 2016 Svetlana Linuxenko