Created
June 16, 2016 11:43
-
-
Save ducksoupdev/38166b93d81106da7d5c784c63714db0 to your computer and use it in GitHub Desktop.
Postal.js Typescript definitions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Type definitions for PostalJS | |
| // Project: https://github.com/postaljs/postal.js | |
| // Definitions By: Bart Breen (https://github.com/barticus) | |
| interface PostalEnvelope { | |
| channel?: string; | |
| topic: string; | |
| timeStamp?: any; | |
| data?: any; | |
| } | |
| interface PostalSubscriptionQuery { | |
| channel?: string; | |
| topic?: string; | |
| context? : any; | |
| } | |
| interface PostalSubscriptionDefinition { | |
| channel: string; | |
| topic: string; | |
| callback: (data: any, env: PostalEnvelope) => any | |
| unsubscribe?(); | |
| } | |
| interface PostalChannel { | |
| channel: string; | |
| topic?: string; | |
| } | |
| interface PostalChannelDefinition extends PostalChannel { | |
| subscribe(topic: string, callback: (data: any, env: PostalEnvelope) => {}): PostalSubscriptionDefinition; | |
| publish(topic: string, data: any); | |
| publish(env: PostalEnvelope); | |
| } | |
| interface PostalSubscriptionCollection { | |
| [channel: string]: PostalSubscriptionChannelCollection | |
| } | |
| interface PostalSubscriptionChannelCollection { | |
| [topic:string]:PostalSubscriptionDefinition[] | |
| } | |
| interface PostalConfiguration { | |
| resolver: any; | |
| DEFAULT_CHANNEL: string; | |
| SYSTEM_CHANNEL: string; | |
| } | |
| interface PostalStatic { | |
| addWireTap(wireTap: (data: any, env: PostalEnvelope) => {}): any; | |
| channel(channelName?: string): PostalChannelDefinition; | |
| configuration: PostalConfiguration; | |
| getSubscribersFor(options?: PostalSubscriptionQuery): PostalSubscriptionDefinition[]; | |
| linkChannels(source: PostalChannel, destination: PostalChannel): PostalSubscriptionDefinition[]; | |
| linkChannels(source: PostalChannel, destination: PostalChannel[]): PostalSubscriptionDefinition[]; | |
| noConflict(): PostalStatic; | |
| publish(env: PostalEnvelope): PostalEnvelope; | |
| reset(); | |
| subscribe(options: PostalSubscriptionDefinition): PostalSubscriptionDefinition; | |
| subscriptions: PostalSubscriptionCollection; | |
| unsubscribe(sub: PostalSubscriptionDefinition); | |
| unsubscribeFor(); | |
| unsubscribeFor(PostalSubscriptionQuery); | |
| wiretaps:(data: any, env: PostalEnvelope) => {}[]; | |
| } | |
| declare module "postal" { | |
| export = postal; | |
| } | |
| declare var postal: PostalStatic; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment