UNPKG

@dutchfurniturefulfilment/skik-client

Version:

Javascript package for integrating a SKIK configurator inside web projects.

49 lines (31 loc) 1.51 kB
# SKIK Client / API / Event subscription The event subscription class is a minimal wrapper that is returned from [`Client # on()`](client#listening-for-events) calls. The object allows you to pause, resume, or entirely kill the event subscription, much like `removeEventListener`, but in a more object-oriented way. ## Read-only properties ```typescript readonly channelName: string; ``` The [event channel](../interfaces/event-channels) name of the event this subscription belongs to. ```typescript readonly isUnsubscribed: boolean; ``` Boolean to check if the event-subscriber unsubscribed. If true, the subscription is effectively dead, and no longer useful. ```typescript readonly isPaused: boolean; ``` Boolean indicating whether handling of events is disabled. if true, events will not be handled, until `EventSubscription # resume()` is called. ## Methods ### Pausing the event subscription's execution ```typescript EventSubscription # pause(): this; ``` Pauses this event subscription. New events will not be handled, until resume() is called. ### Resuming the event subscription's execution ```typescript EventSubscription # resume(): this; ``` Resumes this event subscription. New events will be handled again. ### Discarding an event subscription ```typescript EventSubscription # unsubscribe(): void; ``` Un-subscribes from the event, essentially killing this subscription. After unsubscribe is called, the subscription object can be disposed of (i.e. out of scope / unset reference).