mirror of
https://github.com/flynx/actions.js.git
synced 2025-10-28 18:00:11 +00:00
added ability to set action attrs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ba276961e7
commit
e9df17667b
13
actions.js
13
actions.js
@ -1436,6 +1436,7 @@ object.makeConstructor('ActionSet', MetaActions)
|
||||
// <name> : [
|
||||
// <doc>,
|
||||
// <long-doc>,
|
||||
// <attrs>,
|
||||
// <function>
|
||||
// ],
|
||||
//
|
||||
@ -1454,6 +1455,8 @@ object.makeConstructor('ActionSet', MetaActions)
|
||||
//
|
||||
//
|
||||
// NOTE: the action function is always last.
|
||||
// NOTE: <attrs> if given must be right before the function and must not
|
||||
// be a string...
|
||||
// NOTE: if <prototype> is not given, MetaActions will be used as default.
|
||||
//
|
||||
// For more documentation see: Action(..).
|
||||
@ -1490,8 +1493,16 @@ function Actions(a, b){
|
||||
|
||||
var func = arg.pop()
|
||||
|
||||
// attrs...
|
||||
var last = arg[arg.length-1]
|
||||
var attrs = last != null && typeof(last) != typeof('str') ? arg.pop() : {}
|
||||
|
||||
// create a new action...
|
||||
obj[k] = new Action(k, arg[0], arg[1], func)
|
||||
var a = obj[k] = new Action(k, arg[0], arg[1], func)
|
||||
|
||||
// setup attrs...
|
||||
Object.keys(attrs)
|
||||
.forEach(function(k){ a[k] = attrs[k] })
|
||||
})
|
||||
|
||||
if(proto != null){
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-actions",
|
||||
"version": "1.7.1",
|
||||
"version": "1.8.0",
|
||||
"description": "",
|
||||
"main": "actions.js",
|
||||
"scripts": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user