|
| 1 | +// Generated by typings |
| 2 | +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/emissary/emissary.d.ts |
| 3 | +declare namespace Emissary { |
| 4 | + interface IEmitterStatic extends Mixto.IMixinStatic { |
| 5 | + new ():IEmitter; |
| 6 | + } |
| 7 | + |
| 8 | + interface IEmitter { |
| 9 | + on(eventNames:string, handler:Function):any; // return value type are Signal |
| 10 | + once(eventName:string, handler:Function):any; // return value type are Signal |
| 11 | + signal(eventName:string):void; |
| 12 | + behavior(eventName:string, initialValue:any):void; |
| 13 | + emit(eventName:string, ...args:any[]):void; |
| 14 | + off(eventNames:string, handler:Function):void; |
| 15 | + pauseEvents(eventNames:string):void; |
| 16 | + resumeEvents(eventNames:string):void; |
| 17 | + incrementSubscriptionCount(eventName:string):number; |
| 18 | + decrementSubscriptionCount(eventName:string):number; |
| 19 | + getSubscriptionCount(eventName:string):number; |
| 20 | + hasSubscriptions(eventName:string):boolean; |
| 21 | + } |
| 22 | + |
| 23 | + interface ISubscriberStatic extends Mixto.IMixinStatic { |
| 24 | + new ():ISubscriber; |
| 25 | + } |
| 26 | + |
| 27 | + interface ISubscriber { |
| 28 | + subscribeWith(eventEmitter:any, methodName:string, args:any):ISubscription; |
| 29 | + |
| 30 | + addSubscription(subscription:any):ISubscription; |
| 31 | + |
| 32 | + subscribe(eventEmitterOrSubscription:any, ...args:any[]):ISubscription; |
| 33 | + |
| 34 | + subscribeToCommand(eventEmitter:any, ...args:any[]):ISubscription; |
| 35 | + |
| 36 | + unsubscribe(object?:any):any; |
| 37 | + } |
| 38 | + |
| 39 | + interface ISubscriptionStatic { |
| 40 | + new (emitter: any, eventNames:string, handler:Function):ISubscription; |
| 41 | + } |
| 42 | + |
| 43 | + interface ISubscription extends IEmitter { |
| 44 | + cancelled:boolean; |
| 45 | + |
| 46 | + off():any; |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | +declare module "emissary" { |
| 51 | + var Emitter:Emissary.IEmitterStatic; |
| 52 | + var Subscriber:Emissary.ISubscriberStatic; |
| 53 | + var Signal:Function; // TODO |
| 54 | + var Behavior:Function; // TODO |
| 55 | + var combine:Function; // TODO |
| 56 | +} |
0 commit comments