mirror of
https://github.com/flynx/actions.js.git
synced 2025-10-28 18:00:11 +00:00
cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
635a107f7e
commit
bad795a4ce
123
actions.js
123
actions.js
@ -527,8 +527,7 @@ object.Constructor('Action', {
|
|||||||
handlers: handlers,
|
handlers: handlers,
|
||||||
|
|
||||||
result: res,
|
result: res,
|
||||||
}
|
} },
|
||||||
},
|
|
||||||
post: function(context, data){
|
post: function(context, data){
|
||||||
var res = data.result
|
var res = data.result
|
||||||
|
|
||||||
@ -583,8 +582,7 @@ object.Constructor('Action', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res
|
return res },
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// chaining...
|
// chaining...
|
||||||
@ -633,8 +631,7 @@ object.Constructor('Action', {
|
|||||||
return that.post(context, data) })
|
return that.post(context, data) })
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.post(context, data)
|
return this.post(context, data) },
|
||||||
},
|
|
||||||
chainCall: function(context, inner){
|
chainCall: function(context, inner){
|
||||||
return this.chainApply(context, inner, [...arguments].slice(2)) },
|
return this.chainApply(context, inner, [...arguments].slice(2)) },
|
||||||
|
|
||||||
@ -703,8 +700,7 @@ object.Constructor('Action', {
|
|||||||
Object.assign(meth, attrs)
|
Object.assign(meth, attrs)
|
||||||
Object.assign(func, attrs)
|
Object.assign(func, attrs)
|
||||||
|
|
||||||
return meth
|
return meth },
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -784,8 +780,7 @@ object.Constructor('Alias', {
|
|||||||
|
|
||||||
meth.func.alias = target
|
meth.func.alias = target
|
||||||
|
|
||||||
return meth
|
return meth },
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -823,8 +818,7 @@ module.MetaActions = {
|
|||||||
res.push(k)
|
res.push(k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res
|
return res },
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// List aliases...
|
// List aliases...
|
||||||
@ -886,12 +880,8 @@ module.MetaActions = {
|
|||||||
|
|
||||||
// set alias...
|
// set alias...
|
||||||
} else {
|
} else {
|
||||||
//var parsed = typeof(target) == typeof('str') ?
|
this[alias] = Alias(...arguments)
|
||||||
// this.parseStringAction(target)
|
} }),
|
||||||
// : target
|
|
||||||
this[alias] = Alias.apply(null, arguments)
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
// Get action attribute...
|
// Get action attribute...
|
||||||
@ -1020,8 +1010,7 @@ module.MetaActions = {
|
|||||||
cur = cur.__proto__
|
cur = cur.__proto__
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return res
|
return res },
|
||||||
},
|
|
||||||
|
|
||||||
getPath: function(actions){
|
getPath: function(actions){
|
||||||
var res = {}
|
var res = {}
|
||||||
@ -1046,8 +1035,7 @@ module.MetaActions = {
|
|||||||
|
|
||||||
res[(doc && doc.replace(/[\\\/]$/, '/'+n)) || n] = [n, doc, long_doc]
|
res[(doc && doc.replace(/[\\\/]$/, '/'+n)) || n] = [n, doc, long_doc]
|
||||||
})
|
})
|
||||||
return res
|
return res },
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// Toggle handler cache...
|
// Toggle handler cache...
|
||||||
@ -1119,8 +1107,7 @@ module.MetaActions = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// XXX this is not the handler protocol...
|
// XXX this is not the handler protocol...
|
||||||
return this
|
return this },
|
||||||
},
|
|
||||||
|
|
||||||
// Rest handler cache...
|
// Rest handler cache...
|
||||||
//
|
//
|
||||||
@ -1156,8 +1143,7 @@ module.MetaActions = {
|
|||||||
delete cache[name]
|
delete cache[name]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this
|
return this },
|
||||||
},
|
|
||||||
|
|
||||||
// Get action handlers from the inheritance chain...
|
// Get action handlers from the inheritance chain...
|
||||||
//
|
//
|
||||||
@ -1214,8 +1200,7 @@ module.MetaActions = {
|
|||||||
cache[name] = handlers
|
cache[name] = handlers
|
||||||
}
|
}
|
||||||
|
|
||||||
return handlers
|
return handlers },
|
||||||
},
|
|
||||||
|
|
||||||
// Get structured action handler definitions...
|
// Get structured action handler definitions...
|
||||||
//
|
//
|
||||||
@ -1355,8 +1340,7 @@ module.MetaActions = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return this
|
return this },
|
||||||
},
|
|
||||||
|
|
||||||
// Remove an action callback...
|
// Remove an action callback...
|
||||||
//
|
//
|
||||||
@ -1430,8 +1414,7 @@ module.MetaActions = {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return this
|
return this },
|
||||||
},
|
|
||||||
|
|
||||||
// Register an action callback that will only fire once per event...
|
// Register an action callback that will only fire once per event...
|
||||||
//
|
//
|
||||||
@ -1462,8 +1445,7 @@ module.MetaActions = {
|
|||||||
that.on(action, tag, handler)
|
that.on(action, tag, handler)
|
||||||
})
|
})
|
||||||
|
|
||||||
return this
|
return this },
|
||||||
},
|
|
||||||
|
|
||||||
// XXX EXPERIMENTAL (after calls)...
|
// XXX EXPERIMENTAL (after calls)...
|
||||||
isActionRunning: function(){
|
isActionRunning: function(){
|
||||||
@ -1494,8 +1476,7 @@ module.MetaActions = {
|
|||||||
: this.__action_after_running)
|
: this.__action_after_running)
|
||||||
.push(func)
|
.push(func)
|
||||||
|
|
||||||
return this
|
return this },
|
||||||
},
|
|
||||||
|
|
||||||
// Apply/call a function/action "inside" an action...
|
// Apply/call a function/action "inside" an action...
|
||||||
//
|
//
|
||||||
@ -1590,8 +1571,12 @@ module.MetaActions = {
|
|||||||
|
|
||||||
// Get action/method resolution order...
|
// Get action/method resolution order...
|
||||||
//
|
//
|
||||||
// List mixin tags...
|
// List mixin tags if present, else objects...
|
||||||
// .mro()
|
// .mro()
|
||||||
|
// .mro('tag-object')
|
||||||
|
// -> tags
|
||||||
|
//
|
||||||
|
// List mixin tags...
|
||||||
// .mro('tag')
|
// .mro('tag')
|
||||||
// -> tags
|
// -> tags
|
||||||
//
|
//
|
||||||
@ -1605,18 +1590,21 @@ module.MetaActions = {
|
|||||||
//
|
//
|
||||||
// NOTE: this will return the full MRO including Object.prototype
|
// NOTE: this will return the full MRO including Object.prototype
|
||||||
mro: function(target){
|
mro: function(target){
|
||||||
target = target || 'tag'
|
target = target || 'tag-object'
|
||||||
var res = []
|
var res = []
|
||||||
var cur = this
|
var cur = this
|
||||||
while(cur != null){
|
while(cur != null){
|
||||||
res.push(target == 'tag' ? cur.__mixin_tag
|
res.push(target == 'tag-object' ?
|
||||||
: target == 'object' ? cur
|
cur.__mixin_tag || cur
|
||||||
|
: target == 'tag' ?
|
||||||
|
cur.__mixin_tag
|
||||||
|
: target == 'object' ?
|
||||||
|
cur
|
||||||
: [cur.__mixin_tag, cur])
|
: [cur.__mixin_tag, cur])
|
||||||
// go to next item in chain...
|
// go to next item in chain...
|
||||||
cur = cur.__proto__
|
cur = cur.__proto__
|
||||||
}
|
}
|
||||||
return res
|
return res },
|
||||||
},
|
|
||||||
|
|
||||||
// Get mixin object in inheritance chain...
|
// Get mixin object in inheritance chain...
|
||||||
//
|
//
|
||||||
@ -1633,8 +1621,7 @@ module.MetaActions = {
|
|||||||
.shift()
|
.shift()
|
||||||
return pre ?
|
return pre ?
|
||||||
mro[mro.indexOf(res)-1]
|
mro[mro.indexOf(res)-1]
|
||||||
: res
|
: res },
|
||||||
},
|
|
||||||
|
|
||||||
// Mixin a set of actions into this...
|
// Mixin a set of actions into this...
|
||||||
//
|
//
|
||||||
@ -1719,8 +1706,7 @@ module.MetaActions = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return this
|
return this },
|
||||||
},
|
|
||||||
|
|
||||||
// Same as .inlineMixin(..) but isolates a mixin in a seporate object
|
// Same as .inlineMixin(..) but isolates a mixin in a seporate object
|
||||||
// in the inheritance chain...
|
// in the inheritance chain...
|
||||||
@ -1744,8 +1730,7 @@ module.MetaActions = {
|
|||||||
|
|
||||||
this.__proto__ = proto
|
this.__proto__ = proto
|
||||||
|
|
||||||
return this
|
return this },
|
||||||
},
|
|
||||||
|
|
||||||
// Mixin from after target in the mro...
|
// Mixin from after target in the mro...
|
||||||
//
|
//
|
||||||
@ -1754,8 +1739,7 @@ module.MetaActions = {
|
|||||||
this
|
this
|
||||||
.getMixin(target)
|
.getMixin(target)
|
||||||
.mixin(from, options)
|
.mixin(from, options)
|
||||||
return this
|
return this },
|
||||||
},
|
|
||||||
|
|
||||||
// Mixin a set of local actions into an object...
|
// Mixin a set of local actions into an object...
|
||||||
//
|
//
|
||||||
@ -1808,8 +1792,7 @@ module.MetaActions = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return this
|
return this },
|
||||||
},
|
|
||||||
|
|
||||||
// This is similar in effect but different in mechanics to .inlineMixout(..)
|
// This is similar in effect but different in mechanics to .inlineMixout(..)
|
||||||
//
|
//
|
||||||
@ -1819,16 +1802,13 @@ module.MetaActions = {
|
|||||||
mixout: function(from){
|
mixout: function(from){
|
||||||
var o = this.getMixin(from, true)
|
var o = this.getMixin(from, true)
|
||||||
var target = null
|
var target = null
|
||||||
|
|
||||||
// pop the mixin off the chain...
|
// pop the mixin off the chain...
|
||||||
if(o != null){
|
if(o != null){
|
||||||
target = o.__proto__
|
target = o.__proto__
|
||||||
o.__proto__ = o.__proto__.__proto__
|
o.__proto__ = o.__proto__.__proto__
|
||||||
this.resetHandlerCache()
|
this.resetHandlerCache()
|
||||||
}
|
}
|
||||||
|
return target },
|
||||||
return target
|
|
||||||
},
|
|
||||||
|
|
||||||
// Remove a set of local mixed in actions from object...
|
// Remove a set of local mixed in actions from object...
|
||||||
//
|
//
|
||||||
@ -1852,8 +1832,7 @@ module.MetaActions = {
|
|||||||
o.config = Object.create(this.config)
|
o.config = Object.create(this.config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return o
|
return o },
|
||||||
},
|
|
||||||
|
|
||||||
getHandlerSourceTags: function(name){
|
getHandlerSourceTags: function(name){
|
||||||
return this.getHandlers(name)
|
return this.getHandlers(name)
|
||||||
@ -1873,9 +1852,12 @@ module.MetaActions = {
|
|||||||
// This is here simply as a utility function, to enable running code
|
// This is here simply as a utility function, to enable running code
|
||||||
// in a concatinative manner without interruption...
|
// in a concatinative manner without interruption...
|
||||||
run: function(func){
|
run: function(func){
|
||||||
var res = func ? func.call(this) : undefined
|
var res = func ?
|
||||||
return res === undefined ? this : res
|
func.call(this)
|
||||||
},
|
: undefined
|
||||||
|
return res === undefined ?
|
||||||
|
this
|
||||||
|
: res },
|
||||||
|
|
||||||
|
|
||||||
// doc generators...
|
// doc generators...
|
||||||
@ -1940,8 +1922,7 @@ module.MetaActions = {
|
|||||||
|
|
||||||
handler('\n|')
|
handler('\n|')
|
||||||
|
|
||||||
return str
|
return str },
|
||||||
},
|
|
||||||
getHandlerDocHTML: function(name){
|
getHandlerDocHTML: function(name){
|
||||||
var lst = this.getHandlers(name)
|
var lst = this.getHandlers(name)
|
||||||
var res = $('<div class="action">')
|
var res = $('<div class="action">')
|
||||||
@ -1983,17 +1964,15 @@ module.MetaActions = {
|
|||||||
|
|
||||||
handler(res)
|
handler(res)
|
||||||
|
|
||||||
return res
|
return res },
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// This will create a .config in instances...
|
// This will create a .config in instances...
|
||||||
// NOTE: this makes Actions compatible with lib/object.js...
|
// NOTE: this makes Actions compatible with lib/object.js...
|
||||||
__init__: function(){
|
__init__: function(){
|
||||||
if(this.__proto__.config && !Object.hasOwnProperty(this, 'config')){
|
this.__proto__.config
|
||||||
this.config = Object.create(this.__proto__.config)
|
&& !Object.hasOwnProperty(this, 'config')
|
||||||
}
|
&& (this.config = Object.create(this.__proto__.config)) },
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2088,8 +2067,7 @@ function Actions(a, b){
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return obj
|
return obj }
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2133,8 +2111,7 @@ function(){
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return res
|
return res }
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user