1.0.35 • Published 6 months ago

@types/postal v1.0.35

Weekly downloads
1,043
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/postal

Summary

This package contains type definitions for Postal (https://github.com/postaljs/postal.js).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/postal/v0.

index.d.ts

// Type definitions for Postal v0.8.9
// Project: https://github.com/postaljs/postal.js
// Definitions by: Lokesh Peta <https://github.com/lokeshpeta/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

interface IConfiguration{
    SYSTEM_CHANNEL: string;
    DEFAULT_CHANNEL: string;
    resolver: any;
}

interface ISubscriptionDefinition{
    unsubscribe(): void;
    subscribe(callback: (data: any, envelope: IEnvelope)=> void): void;
    defer():ISubscriptionDefinition;
    disposeAfter(maxCalls: number): ISubscriptionDefinition;
    distinctUntilChanged(): ISubscriptionDefinition;
    once(): ISubscriptionDefinition;
    withConstraint(predicate: Function): ISubscriptionDefinition;
    withConstraints(predicates: Array<Function>): ISubscriptionDefinition;
    
    withContext(context: any): ISubscriptionDefinition;
    withDebounce(milliseconds: number, immediate: boolean ): ISubscriptionDefinition;
    withDelay(milliseconds: number): ISubscriptionDefinition;
    withThrottle(milliseconds: number): ISubscriptionDefinition;
}

interface IEnvelope{
    topic: string;
    data?: any;

    /*Uses DEFAULT_CHANNEL if no channel is provided*/
    channel?: string | undefined;

    timeStamp?: string | undefined;
}


interface IChannelDefinition {
    subscribe(topic: string): ISubscriptionDefinition;
    subscribe(topic: string, callback: (data: any, envelope: IEnvelope)=> void): ISubscriptionDefinition;

    publish(topic: string, data?: any): void;
    publish(envelope: IEnvelope): void;

    channel: string;
}

interface IPostalUtils{
    getSubscribersFor(channel: string, tpc: any): any;
    reset(): void;
}

interface IPostal {
    channel(name?:string): IChannelDefinition;
    
    linkChannels(sources: IEnvelope | IEnvelope[], destinations:  IEnvelope | IEnvelope[]): ISubscriptionDefinition[];
    
    utils: IPostalUtils;

    configuration: IConfiguration;
}

declare var postal: IPostal;

declare module "postal" {
    var postal: IPostal;
    export = postal;
}

Additional Details

  • Last updated: Thu, 08 Jul 2021 20:19:44 GMT
  • Dependencies: none
  • Global values: postal

Credits

These definitions were written by Lokesh Peta.

0.8.5

7 months ago

0.8.4

8 months ago

0.8.7

6 months ago

0.8.6

6 months ago

1.0.33

7 months ago

1.0.32

8 months ago

1.0.35

6 months ago

1.0.34

6 months ago

0.8.3

3 years ago

1.0.31

3 years ago

0.8.2

4 years ago

1.0.30

4 years ago

1.0.29

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

1.0.28

8 years ago

1.0.27

8 years ago

1.0.26

8 years ago

1.0.25-alpha

8 years ago

1.0.24-alpha

8 years ago

1.0.23-alpha

8 years ago

1.0.22-alpha

8 years ago

1.0.21-alpha

8 years ago

1.0.20-alpha

8 years ago

1.0.19-alpha

8 years ago

1.0.14-alpha

8 years ago

1.0.13-alpha

8 years ago