minor rearranging...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-02-24 14:51:35 +03:00
parent c0e982a33c
commit 5268a7d179

View File

@ -177,6 +177,19 @@ Items.ListTitle = function(){}
//--------------------------------------------------------------------- //---------------------------------------------------------------------
var makeEventMethod = function(event, handler){
return function(item){
if(item instanceof Function){
return this.on(event, item)
}
// XXX handle more of the API???
handler.call(this, ...arguments)
return this
}
}
var BaseBrowserClassPrototype = { var BaseBrowserClassPrototype = {
} }
@ -503,21 +516,35 @@ var BaseBrowserPrototype = {
sort: function(){}, sort: function(){},
splice: function(){}, splice: function(){},
// events / actions... // XXX should these be defined on this level or should we use DOM???
focus: function(item){ on: function(evt, handler){
// XXX exclusively set item.focus... return this
}, },
select: function(item){ one: function(evt, handler){
return this
},
off: function(evt, handler){
return this
},
trigger: function(evt, ...args){
return this
},
// events / actions...
focus: makeEventMethod('focus', function(item){
// XXX exclusively set item.focus...
}),
select: makeEventMethod('select', function(item){
// XXX set item.selected... // XXX set item.selected...
}, },
open: function(item){}, open: makeEventMethod('open', function(item){}),
enter: function(item){}, enter: makeEventMethod('enter', function(item){}),
// XXX can we unify these??? // XXX can we unify these???
collapse: function(item){}, collapse: makeEventMethod('collapse', function(item){}),
expand: function(item){}, expand: makeEventMethod('expand', function(item){}),
// XXX target can be item or path... // XXX target can be item or path...
load: function(target){}, load: makeEventMethod('load', function(item){}),
close: function(reason){}, close: makeEventMethod('close', function(reason){}),
// XXX should there return an array or a .constructor(..) instance?? // XXX should there return an array or a .constructor(..) instance??
forEach: function(){}, forEach: function(){},