Commit 041de42d by Иван Кубота

D.assign now creates obj.__un<D.Unsubscribe> where it stores all subscribers

Store.Value.init — handy function for initializing properties. if prop value is already Store.Value — it would bypass.
parent 67d70673
...@@ -740,7 +740,10 @@ NS.apply = function(a,b) { ...@@ -740,7 +740,10 @@ NS.apply = function(a,b) {
continue; continue;
if( name.substr( 0, 2 ) === 'on' ) { if( name.substr( 0, 2 ) === 'on' ) {
obj.on( name.substr( 2, 1 ).toLowerCase()+name.substr( 3 ), cfg[ i ]); if(!obj.__un) {
obj.__un = new D.Unsubscribe()
}
obj.__un.add(obj.on( name.substr( 2, 1 ).toLowerCase()+name.substr( 3 ), cfg[ i ]));
} else { } else {
obj[ i ] = cfg[ i ]; obj[ i ] = cfg[ i ];
} }
......
...@@ -1097,7 +1097,15 @@ Store.Value = { ...@@ -1097,7 +1097,15 @@ Store.Value = {
}), }),
Any: new HookFactory(), Any: new HookFactory(),
Array: new HookFactory(ArrayStore.linearPrototype, function(obj){obj._listeners = {}; return obj._exposeGet.call({_props: []}); }), Array: new HookFactory(ArrayStore.linearPrototype, function(obj){obj._listeners = {}; return obj._exposeGet.call({_props: []}); }),
Function: new HookFactory() Function: new HookFactory(),
init: function(type, value){
if(value){
if(value instanceof Store.Value[type]) {
return value
}
}
return new Store.Value[type](value);
}
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment