mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
added stub event object...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
201f87ba52
commit
1721639b3f
@ -196,12 +196,19 @@ var makeEventMethod = function(event, handler){
|
||||
return this.on(event, item)
|
||||
}
|
||||
|
||||
// XXX STUG: event object...
|
||||
// XXX can we generate this in one spot???
|
||||
// ...currently it is generated here and in .trigger(..)
|
||||
var evt = {
|
||||
name: event,
|
||||
}
|
||||
|
||||
// XXX handle more of the API???
|
||||
handler
|
||||
&& handler.call(this, ...arguments)
|
||||
&& handler.call(this, evt, ...arguments)
|
||||
|
||||
// XXX we should get the actual item and pass it on...
|
||||
this.trigger(event, ...arguments)
|
||||
this.trigger(evt, ...arguments)
|
||||
|
||||
return this
|
||||
}
|
||||
@ -574,9 +581,14 @@ var BaseBrowserPrototype = {
|
||||
},
|
||||
trigger: function(evt, ...args){
|
||||
var that = this
|
||||
;((this.__event_handlers || {})[evt] || [])
|
||||
var evt = typeof(evt) == typeof('str') ?
|
||||
{
|
||||
name: evt
|
||||
}
|
||||
: evt
|
||||
;((this.__event_handlers || {})[evt.name] || [])
|
||||
.forEach(function(handler){
|
||||
handler.call(that, ...args) })
|
||||
handler.call(that, evt, ...args) })
|
||||
return this
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user