minor fixes and notes...

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

View File

@ -491,6 +491,7 @@ object.makeConstructor('BaseItem',
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// View/Clone Mixin...
var getMixinRoot = function(o, attr){ var getMixinRoot = function(o, attr){
var cur = o var cur = o
@ -500,15 +501,11 @@ var getMixinRoot = function(o, attr){
cur = cur.source } cur = cur.source }
return cur } return cur }
var BrowserViewMixin = { var BrowserViewMixin = {
// source: <object>, // source: <object>,
// //
// query: { // query: [ .. ],
// // XXX doc...
// action: <str> | <array>,
//
// args: <array>
// }
// keep the DOM data in one place (.source)... // keep the DOM data in one place (.source)...
// //
@ -525,6 +522,8 @@ var BrowserViewMixin = {
set container(value){ set container(value){
getMixinRoot(this, '__container').container = value }, getMixinRoot(this, '__container').container = value },
isView: function(){
return true },
end: function(){ end: function(){
return this.source }, return this.source },
@ -538,8 +537,8 @@ var BrowserViewMixin = {
// ...not sure of the correct way to do this, "weak" event handler??? // ...not sure of the correct way to do this, "weak" event handler???
// XXX how do we handle sections??? // XXX how do we handle sections???
__refresh: function(){ __refresh: function(){
var action = this.query.action var source = this.source
var args = this.query.args var [action, ...args] = this.query
this.items = this.items =
action instanceof Array ? action instanceof Array ?
@ -547,8 +546,8 @@ var BrowserViewMixin = {
.map(function(e){ .map(function(e){
return that.get(e) }) return that.get(e) })
: action ? : action ?
that[action](...args) source[action](...args)
: that.items.slice() : source.items.slice()
return this return this
}, },
@ -3604,17 +3603,13 @@ var BaseBrowserPrototype = {
{ {
__proto__: this, __proto__: this,
source: this, source: this,
// XXX // XXX
query: { query: [...arguments],
action,
args,
},
}, },
BrowserViewMixin) BrowserViewMixin)
.__refresh() }, .__refresh() },
isView: function(){ isView: function(){
return !!this.source }, return false },
} }