mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08:00
Add ko.untrack() to knockout.es5
See https://github.com/SteveSanderson/knockout-es5/blob/75773a52f543380aa6dbf6ccffb4b8fc56fa8a2a/src/knockout-es5.js#L196
This commit is contained in:
@@ -54,6 +54,11 @@ class OrderLine {
|
||||
public getSubtotal(): string {
|
||||
return "$" + (this.price * this.quantity).toFixed(2);
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
// Dispose of all the observables of this object to prevent memory leaks
|
||||
ko.untrack(this);
|
||||
}
|
||||
}
|
||||
|
||||
class Order {
|
||||
@@ -83,4 +88,4 @@ anOrder.lines.removeAll();
|
||||
|
||||
anOrder.lines.destroy(someOrderLine);
|
||||
anOrder.lines.destroyAll([someOrderLine]);
|
||||
anOrder.lines.destroyAll();
|
||||
anOrder.lines.destroyAll();
|
||||
|
||||
Vendored
+2
-1
@@ -7,6 +7,7 @@
|
||||
|
||||
interface KnockoutStatic {
|
||||
track(obj: any, propertyNames?: Array<string>): any;
|
||||
untrack(obj: any, propertyNames?: Array<string>): any;
|
||||
defineProperty(obj: any, propertyName: string, evaluator: Function): any;
|
||||
defineProperty(obj: any, propertyName: string, options: KnockoutDefinePropertyOptions): any;
|
||||
getObservable(obj: any, propertyName: string): KnockoutObservable<any>;
|
||||
@@ -26,4 +27,4 @@ interface Array<T> {
|
||||
destroy(item: T): void;
|
||||
destroyAll(items: T[]): void;
|
||||
destroyAll(): void;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user