mirror of
https://github.com/flynx/actions.js.git
synced 2025-10-29 18:30:10 +00:00
working on docs..
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b245275733
commit
05c411e7ba
39
README.md
39
README.md
@ -55,7 +55,46 @@ code.
|
|||||||
|
|
||||||
### The main entities:
|
### The main entities:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Action set...
|
||||||
|
var Base = Actions({
|
||||||
|
get value(){
|
||||||
|
return this.__value || 0
|
||||||
|
},
|
||||||
|
set value(val){
|
||||||
|
this.__value = val
|
||||||
|
},
|
||||||
|
|
||||||
|
print: [function(){
|
||||||
|
console.log(this.value)
|
||||||
|
}],
|
||||||
|
|
||||||
|
times: ['get value',
|
||||||
|
function(n){
|
||||||
|
this.value *= n
|
||||||
|
|
||||||
|
return this.value
|
||||||
|
}],
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
var Extending = Actions(Base, {
|
||||||
|
times: [function(n){
|
||||||
|
console.log(this.value, 'times', n, 'is:')
|
||||||
|
|
||||||
|
return function(result, n){
|
||||||
|
console.log(' ', this.value)
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
**Action set**
|
**Action set**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- an object containing a number of actions,
|
- an object containing a number of actions,
|
||||||
- optionally, directly or indirectly inherited from `MetaActions`
|
- optionally, directly or indirectly inherited from `MetaActions`
|
||||||
and/or other action sets,
|
and/or other action sets,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user