UNPKG

@sassoftware/vi-api

Version:
80 lines (79 loc) 3.36 kB
export declare const TAB_ACTIVE_EVENT = "SNG_TAB_ACTIVE"; export declare const CONTENT_PANE_RESIZE_EVENT = "SNG_CONTENT_PANE_RESIZE"; export declare enum PageEvents { ChildObjectOnSelect = "spb:ChildObjectSelect", CommentsOnShowEvent = "spb::Comments:onShow", DirtyStateChangeEvent = "spb::dirty-state-change", DragMoveEvent = "spb::dragMove", DragStopEvent = "spb::dragStop", LoadDocumentEvent = "spb::page-load-all", ModeChangeEvent = "spb::page-mode-change", ModelChangeEvent = "spb::page-model-change", PanelOpenEvent = "spb::sliding-panel-open", RefreshAttachmentsGrid = "spb::refreshAttachmentsGrid", RefreshPageEvent = "spb::refreshPage", SelectAttachmentEvent = "spb::Highlighting:SelectAttachment", SelectChildObjectEvent = "spb::Highlighting:SelectChildObject", SelectCommentEvent = "spb::Highlighting:SelectComment", SelectNodeEvent = "spb::selectNode", UpdateSubDocumentTypeEvent = "spb::updateSubDocumentType", TabSelectedEvent = "spb::tabSelected", VisitAllTabs = "spb::mark-all-tabs-visited", MaskEvent = "spb::mask", UnmaskEvent = "spb::unmask", MaskResetEvent = "spb::mask-reset", ClearDateFieldEvent = "spb::clear-date-field", BroadcastControlEvent = "spb::broadcast-control-change" } export declare enum AdminEvents { SelectedDocumentChangeEvent = "admin::document-selected-change", SelectedListChangeEvent = "admin::list-change-event", DeleteListEvent = "admin::delete-list", ReferenceDataSavedEvent = "admin::reference-data-saved", DocumentListChangedEvent = "admin::document-list-changed" } export declare enum DocumentGeneratorEvents { AfterDocumentGenerated = "docgen::after-document-generated" } export interface Subscription { unsubscribe(): void; } /** * This API provides the details and functionality associated with publishing and subscribing to events. * * Accessed from the window at `window.sas.vi.event`. * * @example window.sas.vi.event.publish("eventName", payload); * @category API */ export interface EventApi { /** * @method * @description Publishes an event for subscribers to consume. * @param eventName {string} Name of the event to publish. * @param [payload] {any} Data passed to all subscribers. */ publish(eventName: string, payload?: any): void; /** * @method * @description Subscribes to an event and registers a function to be called on any future published events. * If the eventName does not exist, it is created. * @param {string} eventName Name of the event to subscribe to. * @param {EventApi~subscriptionCallback} observer Invoked when the subscription is triggered by an event. * Has access to the event's payload. * @returns The subscription being made to the event. */ subscribe(eventName: string, observer: (payload: any) => void): Subscription | undefined; /** * @method * @description Unsubscribe from a given subscription and stop listening for events. * @param subscription {Subscription} Subscription to stop. */ unsubscribe(subscription: Subscription): void; } /** * Callback function executed when subscription is triggered by an event. * @callback EventApi~subscriptionCallback * @param payload {any} Payload of the subscription. * @returns {void} */