some tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-07-05 22:09:15 +03:00
parent e037755d0f
commit 572a5f1376

View File

@ -500,7 +500,16 @@ var getMixinRoot = function(o, attr){
cur = cur.source } cur = cur.source }
return cur } return cur }
var BrowserCloneMixin = { var BrowserViewMixin = {
// source: <object>,
//
// query: {
// // XXX doc...
// action: <str> | <array>,
//
// args: <array>
// }
// keep the DOM data in one place (.source)... // keep the DOM data in one place (.source)...
// //
// NOTE: this is in contrast to the rest of the props that // NOTE: this is in contrast to the rest of the props that
@ -518,6 +527,36 @@ var BrowserCloneMixin = {
end: function(){ end: function(){
return this.source }, return this.source },
// NOTE: we are not simply doing this in .make(..) as we need to be
// able to refresh the data without triggering .make(..) on the
// source object...
// XXX should this be .refresh()???
// ...if yes what's going to be the difference between it here
// and in the source object???
// XXX also need to track source objects .make(..) calls...
// ...not sure of the correct way to do this, "weak" event handler???
// XXX how do we handle sections???
__refresh: function(){
var action = this.query.action
var args = this.query.args
this.items =
action instanceof Array ?
action
.map(function(e){
return that.get(e) })
: action ?
that[action](...args)
: that.items.slice()
return this
},
make: function(){
var res = this.__proto__.make(...arguments)
this.__refresh()
return res
},
} }
@ -3535,12 +3574,14 @@ var BaseBrowserPrototype = {
// XXX EXPERIMENTAL... // XXX EXPERIMENTAL...
// - set correct isolation boundary between this and .source... // - set correct isolation boundary between this and .source...
// - make this a real instance... // - make this a real instance (???)
// ...do we need this for anything other than doc???
// - return from selectors... // - return from selectors...
// - treat .items as cache // - treat .items as cache
// -> reset on parent .make(..) // -> reset on parent .make(..)
// -> re-acquire data (???) // -> re-acquire data (???)
// - take control (optionally), i.e. handle keyboard // - take control (optionally), i.e. handle keyboard
// XXX need to trigger an update (or invalidation) on .make(..)...
// XXX BUG?: .update(..) from events resolves to the .source... // XXX BUG?: .update(..) from events resolves to the .source...
// to reproduce: // to reproduce:
// dialog // dialog
@ -3559,21 +3600,19 @@ var BaseBrowserPrototype = {
// NOTE: for super calls do: // NOTE: for super calls do:
// this.__proto__.<method>.call(this, ...) // this.__proto__.<method>.call(this, ...)
return object return object
.mixinFlat({ .mixinFlat(
__proto__: this, {
source: this, __proto__: this,
}, source: this,
BrowserCloneMixin)
.run(function(){ // XXX
// XXX how do we handle sections??? query: {
this.items = action,
action instanceof Array ? args,
action },
.map(function(e){ },
return that.get(e) }) BrowserViewMixin)
: action ? .__refresh() },
that[action](...args)
: that.items.slice() }) },
isView: function(){ isView: function(){
return !!this.source }, return !!this.source },
} }