## Subscription ```ts interface ISubscription { readonly subscribe: IObservable; readonly emit: IObserver; isActivated(): boolean; activate(): this; deactivate(): this; toggle(activate?: boolean): this; } ``` ```ts interface ISubscriptionConstructor { new( subscribe: IObservable, emit: IObserver, ): ISubscription; } ``` An *Subscription* is used to link a *Observable* with an *Observer* using an `activate`/`deactivate` mechanism. ### Examples #### Toggle a 'mousemove' Observable on 'click' ```ts const subscription = new Subscription( fromEventTarget(window, 'mousemove'), (event: MouseEvent) => { console.log(event.clientX, event.clientY); }, ); const subscribe = fromEventTarget(window, 'click'); subscribe(() => { subscription.toggle(); }); ```