mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-15 22:40:21 +00:00
Merge pull request #2945 from Igorbek/knockout-revert
Revert commits to knockout made by EWOUT-QMINO\Ewout
This commit is contained in:
Vendored
+19
-32
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Knockout v3.2.0
|
||||
// Type definitions for Knockout v3.2.0-beta
|
||||
// Project: http://knockoutjs.com
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Igor Oleinikov <https://github.com/Igorbek/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -53,33 +53,12 @@ interface KnockoutSubscription {
|
||||
}
|
||||
|
||||
interface KnockoutSubscribable<T> extends KnockoutSubscribableFunctions<T> {
|
||||
subscribe(callback: (param : any) => void, target?: any, event?: string): KnockoutSubscription;
|
||||
subscribe(callback: (param : any) => void, target: any, event: string): KnockoutSubscription;
|
||||
subscribe(callback: (newValue: T) => void, target?: any, event?: string): KnockoutSubscription;
|
||||
subscribe<TEvent>(callback: (newValue: TEvent) => void, target: any, event: string): KnockoutSubscription;
|
||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutSubscribable<T>;
|
||||
getSubscriptionsCount(): number;
|
||||
}
|
||||
|
||||
interface KnockoutObservableProperties<T>{
|
||||
(): T;
|
||||
(value: T): void;
|
||||
|
||||
peek(): T;
|
||||
valueHasMutated?:{(): void;};
|
||||
valueWillMutate?:{(): void;};
|
||||
}
|
||||
|
||||
interface KnockoutObservableStatic {
|
||||
fn: KnockoutObservableFunctions<any>;
|
||||
|
||||
<T>(value?: T): KnockoutObservable<T>;
|
||||
}
|
||||
|
||||
interface KnockoutObservable<T> extends KnockoutSubscribable<T>, KnockoutObservableProperties<T>, KnockoutObservableFunctions<T> {
|
||||
subscribe(callback: (newValue : T) => void, target?: any, event?: string): KnockoutSubscription;
|
||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutObservable<T>;
|
||||
}
|
||||
|
||||
interface KnockoutComputedStatic {
|
||||
fn: KnockoutComputedFunctions<any>;
|
||||
|
||||
@@ -104,18 +83,26 @@ interface KnockoutObservableArrayStatic {
|
||||
<T>(value?: T[]): KnockoutObservableArray<T>;
|
||||
}
|
||||
|
||||
interface KnockoutObservableArray<T> extends KnockoutSubscribable<T[]>, KnockoutObservableProperties<T[]>,KnockoutObservableArrayFunctions<T> {
|
||||
subscribe(callback: (changes : KnockoutArrayChange<T>[]) => void, target: any, event: string): KnockoutSubscription;
|
||||
subscribe(callback: (changes : KnockoutArrayChange<T>[]) => void, target: any, event: 'arrayChange'): KnockoutSubscription;
|
||||
|
||||
subscribe(callback: (param : T[]) => void, target?: any, event?: string): KnockoutSubscription;
|
||||
subscribe(callback: (param : T[]) => void, target: any, event: string): KnockoutSubscription;
|
||||
subscribe(callback: (param : T[]) => void, target: any, event: 'change'): KnockoutSubscription;
|
||||
subscribe(callback: (param : T[]) => void, target: any, event: 'beforeChange'): KnockoutSubscription;
|
||||
|
||||
interface KnockoutObservableArray<T> extends KnockoutObservable<T[]>, KnockoutObservableArrayFunctions<T> {
|
||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutObservableArray<T>;
|
||||
}
|
||||
|
||||
interface KnockoutObservableStatic {
|
||||
fn: KnockoutObservableFunctions<any>;
|
||||
|
||||
<T>(value?: T): KnockoutObservable<T>;
|
||||
}
|
||||
|
||||
interface KnockoutObservable<T> extends KnockoutSubscribable<T>, KnockoutObservableFunctions<T> {
|
||||
(): T;
|
||||
(value: T): void;
|
||||
|
||||
peek(): T;
|
||||
valueHasMutated?:{(): void;};
|
||||
valueWillMutate?:{(): void;};
|
||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutObservable<T>;
|
||||
}
|
||||
|
||||
interface KnockoutComputedDefine<T> {
|
||||
read(): T;
|
||||
write? (value: T): void;
|
||||
|
||||
@@ -108,27 +108,6 @@ function testGetter() {
|
||||
|
||||
function test_observableArrays() {
|
||||
var myObservableArray = ko.observableArray<any>();
|
||||
|
||||
myObservableArray.subscribe(function(changes){
|
||||
for(var i = 0; i < changes.length; i++){
|
||||
console.log(changes[i].index);
|
||||
console.log(changes[i].status);
|
||||
console.log(changes[i].value);
|
||||
}
|
||||
}, null, "arrayChange");
|
||||
|
||||
myObservableArray.subscribe(function(newValue){
|
||||
console.log(newValue);
|
||||
}, null, "change");
|
||||
|
||||
myObservableArray.subscribe(function(oldValue){
|
||||
console.log(oldValue);
|
||||
}, null, "beforeChange");
|
||||
|
||||
myObservableArray.subscribe(function(newValue){
|
||||
console.log(newValue);
|
||||
});
|
||||
|
||||
myObservableArray.push('Some value');
|
||||
var anotherObservableArray = ko.observableArray([
|
||||
{ name: "Bungle", type: "Bear" },
|
||||
|
||||
Reference in New Issue
Block a user