testing a different way to handle callbacks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-01-24 18:10:53 +03:00
parent 7d3d7a1ff3
commit fc88967873
2 changed files with 8 additions and 7 deletions

View File

@ -1252,11 +1252,10 @@ function(spec, callback){
// other... // other...
: that(field) }) : that(field) })
// batch callback... // batch callback...
var cb
callback callback
// only setup events once...
&& !spec.__batch_setup
&& this.dialog && this.dialog
.close(function(mode){ .one('close', cb = function(mode){
// XXX get the field data and pass it to the callback... // XXX get the field data and pass it to the callback...
callback( callback(
// get the field-value pairs... // get the field-value pairs...
@ -1275,9 +1274,11 @@ function(spec, callback){
spec, spec,
// XXX is this the right spot for this??? // XXX is this the right spot for this???
mode) }) mode) })
// XXX BUG: if user passes a new spec each time this will not work... // reset the callback on update...
// ...might be a good idea to bind to the element... // XXX this does not work yet...
spec.__batch_setup = true .one('update', function(){
// XXX BUG: this.off(..) will not work with non-standard events...
this.dom.off('close', cb) })
return this } return this }

View File

@ -30,7 +30,7 @@ function(name){
name in this.dom ? name in this.dom ?
// proxy handler... // proxy handler...
this.dom[name].apply(this.dom, args) this.dom[name](...args)
// on/trigger handlers... // on/trigger handlers...
: this.dom.trigger(name, args) : this.dom.trigger(name, args)