mirror of
https://github.com/flynx/actions.js.git
synced 2025-10-30 02:40:10 +00:00
updated docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
a59bd98abf
commit
57122965de
25
README.md
25
README.md
@ -52,6 +52,9 @@ Another thing to note here is that the code above, though quite simple is
|
|||||||
not reusable, i.e.:
|
not reusable, i.e.:
|
||||||
- we can't simply use the extending method for any other parent unless we
|
- we can't simply use the extending method for any other parent unless we
|
||||||
either copy/rewrite it or complicate the code.
|
either copy/rewrite it or complicate the code.
|
||||||
|
ES5/ES6 only partially fixes this issue as `super` can only be used in
|
||||||
|
some cases (literal methods) and not others (functions and functions as
|
||||||
|
methods) which complicates things and makes them non-uniform.
|
||||||
- we can't use the extending method stand-alone, for example for testing
|
- we can't use the extending method stand-alone, for example for testing
|
||||||
|
|
||||||
It is possible to go around these issues but not without introducing
|
It is possible to go around these issues but not without introducing
|
||||||
@ -140,7 +143,6 @@ n
|
|||||||
The only two things _inherited_ from the object defining the actions
|
The only two things _inherited_ from the object defining the actions
|
||||||
via the mixin methods or `mix` function are properties and actions,
|
via the mixin methods or `mix` function are properties and actions,
|
||||||
all data, including normal methods is discarded.
|
all data, including normal methods is discarded.
|
||||||
_(this is not final)_
|
|
||||||
|
|
||||||
|
|
||||||
**Notes:**
|
**Notes:**
|
||||||
@ -221,26 +223,27 @@ Root Action o---|---x
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- a method, created by `Action(..)`,
|
- `Action(..)` creates a method (an _action_),
|
||||||
- calls all the shadowed/overloaded actions in the inheritance
|
- an _action_ calls all the shadowed/overloaded actions in the inheritance
|
||||||
chain in sequence implicitly,
|
chain in sequence implicitly,
|
||||||
**Notes:**
|
**Notes:**
|
||||||
- there is no way to prevent an action in the chain from
|
- there is no way to prevent an action in the chain from
|
||||||
running, this is by design, i.e. no way to fully shadow.
|
running, this is by design, i.e. no way to fully shadow.
|
||||||
- actions that do not shadow anything are called _base_ or _root actions_.
|
- top actions in the inheritance chain are called _base_ or _root actions_.
|
||||||
- returns the action set (`this`) by default (for call chaining),
|
- an action returns the action set (`this`) by default (for call chaining),
|
||||||
- the base/root action can return any value.
|
- the base/root action can return any value.
|
||||||
**Notes:**
|
**Notes:**
|
||||||
- if undefined is returned, it will be replaced by the
|
- if undefined is returned, it will be replaced by the
|
||||||
action context/action set.
|
action context/action set.
|
||||||
|
- `false` and `null` are returned as-is.
|
||||||
- there is no distinction between root and other actions
|
- there is no distinction between root and other actions
|
||||||
other than that root action's return values are not
|
other than that root action's return values are not
|
||||||
ignored.
|
ignored.
|
||||||
- can consist of two parts: the first is called before the
|
- an action can consist of two parts: the first is called before the
|
||||||
shadowed action (_pre-callback_) and the second after (_post-callback_).
|
next action in chain (_pre-callback_) and the second after (_post-callback_).
|
||||||
- post-callback has access to the return value and can modify it
|
- post-callback has access to the return value and can modify it
|
||||||
but not replace it.
|
but not replace it.
|
||||||
- can be bound to, a-la an event, calling the handlers when it is
|
- an action can be bound to, a-la an event, calling the handlers when it is
|
||||||
called (_see below_),
|
called (_see below_),
|
||||||
|
|
||||||
|
|
||||||
@ -263,9 +266,9 @@ action_set.on('action_name.pre', function(){
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
- a function,
|
- a handler is a function,
|
||||||
- can be bound to run before and/or after the action itself,
|
- it can be bound to run before and/or after the action itself,
|
||||||
- is local to an action set it was bound via,
|
- it is local to an action set it was bound via,
|
||||||
- when an action is triggered from an action set, all the pre
|
- when an action is triggered from an action set, all the pre
|
||||||
handlers in its inheritance chain will be called before the
|
handlers in its inheritance chain will be called before the
|
||||||
respective actions they are bound to and all the post handlers
|
respective actions they are bound to and all the post handlers
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user