From c6ba5a2416a0eba18ec71455274d745755804b08 Mon Sep 17 00:00:00 2001 From: Judah Gabriel Himango Date: Fri, 28 Dec 2012 10:05:58 -0600 Subject: [PATCH] Added knockout.postbox --- knockout.postbox/knockout-postbox.d.ts | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 knockout.postbox/knockout-postbox.d.ts diff --git a/knockout.postbox/knockout-postbox.d.ts b/knockout.postbox/knockout-postbox.d.ts new file mode 100644 index 000000000..21c10382e --- /dev/null +++ b/knockout.postbox/knockout-postbox.d.ts @@ -0,0 +1,48 @@ +interface KnockoutPostBox { + subscribe: (topic: string, handler: (value) => void, target?: any) => KnockoutObservableAny; + publish: (topic: string, value?: any) => KnockoutObservableAny; +} + +interface KnockoutObservableString { + subscribeTo: (topic: string, useLastPublishedValueToInitialize?: bool, transform?: (val: any) => string) => KnockoutObservableString; + unsubscribeFrom: (topic: string) => KnockoutObservableString; + publishOn: (topic: string, skipInitialPublish?: bool, equalityComparer?: (newValue: string, oldValue: string) => bool) => KnockoutObservableString; + stopPublishingOn: (topic: string) => KnockoutObservableString; + syncWith: (topic: string, initializeWithLatestValue?: bool, skipInitialPublish?: bool, equalityComparer?: (newValue: string, oldValue: string) => bool) => KnockoutObservableString; +} + +interface KnockoutObservableDate { + subscribeTo: (topic: string, useLastPublishedValueToInitialize?: bool, transform?: (val: any) => Date) => KnockoutObservableDate; + unsubscribeFrom: (topic: string) => KnockoutObservableDate; + publishOn: (topic: string, skipInitialPublish?: bool, equalityComparer?: (newValue: Date, oldValue: Date) => bool) => KnockoutObservableDate; + stopPublishingOn: (topic: string) => KnockoutObservableDate; + syncWith: (topic: string, initializeWithLatestValue?: bool, skipInitialPublish?: bool, equalityComparer?: (newValue: Date, oldValue: Date) => bool) => KnockoutObservableDate; +} + +interface KnockoutObservableNumber { + subscribeTo: (topic: string, useLastPublishedValueToInitialize?: bool, transform?: (val: any) => number) => KnockoutObservableNumber; + unsubscribeFrom: (topic: string) => KnockoutObservableNumber; + publishOn: (topic: string, skipInitialPublish?: bool, equalityComparer?: (newValue: Number, oldValue: Number) => bool) => KnockoutObservableNumber; + stopPublishingOn: (topic: string) => KnockoutObservableNumber; + syncWith: (topic: string, initializeWithLatestValue?: bool, skipInitialPublish?: bool, equalityComparer?: (newValue: Number, oldValue: Number) => bool) => KnockoutObservableNumber; +} + +interface KnockoutObservableBool { + subscribeTo: (topic: string, useLastPublishedValueToInitialize?: bool, transform?: (val: any) => bool) => KnockoutObservableBool; + unsubscribeFrom: (topic: string) => KnockoutObservableBool; + publishOn: (topic: string, skipInitialPublish?: bool, equalityComparer?: (newValue: bool, oldValue: bool) => bool) => KnockoutObservableBool; + stopPublishingOn: (topic: string) => KnockoutObservableBool; + syncWith: (topic: string, initializeWithLatestValue?: bool, skipInitialPublish?: bool, equalityComparer?: (newValue: bool, oldValue: bool) => bool) => KnockoutObservableBool; +} + +interface KnockoutObservableAny { + subscribeTo: (topic: string, useLastPublishedValueToInitialize?: bool, transform?: (val: any) => any) => KnockoutObservableAny; + unsubscribeFrom: (topic: string) => KnockoutObservableAny; + publishOn: (topic: string, skipInitialPublish?: bool, equalityComparer?: (newValue: any, oldValue: any) => bool) => KnockoutObservableAny; + stopPublishingOn: (topic: string) => KnockoutObservableAny; + syncWith: (topic: string, initializeWithLatestValue?: bool, skipInitialPublish?: bool, equalityComparer?: (newValue: any, oldValue: any) => bool) => KnockoutObservableAny; +} + +interface KnockoutStatic { + postbox: KnockoutPostBox; +} \ No newline at end of file