Comparing version 0.0.5 to 0.0.6
import { IObservable, ISubscriber, ISubscriberFunction } from './IObservable'; | ||
import Observable from './Observable'; | ||
import ObservableArray from './ObservableArray'; | ||
export interface ObservableIndex { | ||
[index: string]: Observable<any>; | ||
[index: string]: IObservable<any>; | ||
} | ||
@@ -20,5 +18,5 @@ export default class Graph { | ||
static disposeAll(obj: any): void; | ||
static attachGraph(obj: any): void; | ||
static createProperty(obj: any, property: string, observable: Observable<any> | ObservableArray<any>): void; | ||
static attachObservable<T>(obj: any, property: string, observable: Observable<T> | ObservableArray<T>, readOnly?: boolean): void; | ||
static attachGraph(obj: any): Graph; | ||
static createProperty(obj: any, property: string, observable: IObservable<any>): void; | ||
static attachObservable<T>(obj: any, property: string, observable: IObservable<T>, readOnly?: boolean): void; | ||
static createObservable<T>(obj: any, property: string, value: T): void; | ||
@@ -31,5 +29,6 @@ static createComputed<T>(obj: any, property: string, definition: (n?: T) => T, defer?: boolean): void; | ||
static run(obj: any, property: string): any; | ||
static getObservable(obj: any, property: any): Observable<any>; | ||
static getObservable(obj: any, property: any): IObservable<any>; | ||
static getSubscribers(obj: any, property: any): (ISubscriber | ISubscriberFunction<any>)[]; | ||
static getReferences(obj: any, property: string): IObservable<any>[]; | ||
static wrapContext(callback: () => any, thisArg?: any): IObservable<any>[]; | ||
} |
@@ -11,3 +11,3 @@ "use strict"; | ||
Graph.prototype.peek = function (property) { | ||
return this.observables[property].value; | ||
return this.observables[property].peek(); | ||
}; | ||
@@ -43,4 +43,5 @@ Graph.prototype.getReferences = function (property) { | ||
var observable = this.observables[index]; | ||
if (observable.value && observable.value._graph) { | ||
observable.value._graph.disposeAll(); | ||
var value = observable.peek(); | ||
if (value && value._graph) { | ||
value._graph.disposeAll(); | ||
} | ||
@@ -98,9 +99,10 @@ observable.dispose(); | ||
} | ||
return obj._graph; | ||
}; | ||
Graph.createProperty = function (obj, property, observable) { | ||
Graph.attachGraph(obj); | ||
if (obj._graph.observables[property]) { | ||
observable.subscribers = obj._graph.observables[property].subscribers; | ||
var graph = Graph.attachGraph(obj); | ||
if (graph.observables[property]) { | ||
observable.subscribers = graph.observables[property].subscribers; | ||
} | ||
obj._graph.observables[property] = observable; | ||
graph.observables[property] = observable; | ||
}; | ||
@@ -177,2 +179,12 @@ Graph.attachObservable = function (obj, property, observable, readOnly) { | ||
}; | ||
Graph.wrapContext = function (callback, thisArg) { | ||
Observable_1.default.pushContext(); | ||
if (thisArg) { | ||
callback.call(thisArg); | ||
} | ||
else { | ||
callback(); | ||
} | ||
return Observable_1.default.popContext(); | ||
}; | ||
return Graph; | ||
@@ -179,0 +191,0 @@ }()); |
@@ -16,2 +16,3 @@ import '../jsx/JSX'; | ||
static render: typeof VirtualDom.render; | ||
static attachGraph: typeof Graph.attachGraph; | ||
static attachObservable: typeof Graph.attachObservable; | ||
@@ -27,2 +28,3 @@ static createObservable: typeof Graph.createObservable; | ||
static getReferences: typeof Graph.getReferences; | ||
static wrapContext: typeof Graph.wrapContext; | ||
} |
@@ -28,2 +28,3 @@ "use strict"; | ||
Cascade.render = VirtualDom_1.default.render; | ||
Cascade.attachGraph = Graph_1.default.attachGraph; | ||
Cascade.attachObservable = Graph_1.default.attachObservable; | ||
@@ -39,2 +40,3 @@ Cascade.createObservable = Graph_1.default.createObservable; | ||
Cascade.getReferences = Graph_1.default.getReferences; | ||
Cascade.wrapContext = Graph_1.default.wrapContext; | ||
//# sourceMappingURL=Cascade.js.map |
{ | ||
"name": "cascade", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A library for creating modern user interfaces.", | ||
@@ -5,0 +5,0 @@ "author": "Sean Johnson <sjohnson@sjohnsonaz.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104207
2699