UNPKG

@tangential/core

Version:

Core types and support code for Tangential

44 lines (43 loc) 1.64 kB
import { Observable } from 'rxjs'; import * as i0 from "@angular/core"; export declare type BusMessageIntent = 'request' | 'action' | 'event' | 'notification' | 'log'; export declare const Intention: { /** * An action has been performed. For example, a user has been created, granted a permission, removed, etc. */ action: BusMessageIntent; /** * A general event, typically used to communicate UI state across domains. */ event: BusMessageIntent; /** * A BusMessage whose intent is to record a log message. */ log: BusMessageIntent; /** * A BusMessage whose intent is to provide a message to the Visitor. It is up to the currently active UI to determine the best method * of sharing the message payload. */ notification: BusMessageIntent; /** * A BusMessage that communicates that the current Visitor has requested than an action be performed. For example, clicked a button * that is intended to result in a user being created, a permission being granted, etc. */ request: BusMessageIntent; }; export declare class BusMessage { id: string; intent: BusMessageIntent; key: string; source: string; /** @todo: 'intent' should probably be handled by static creation methods. */ constructor(source: string, intent?: BusMessageIntent, key?: string); } export declare class MessageBus { all: Observable<BusMessage>; private bus; constructor(); post(message: BusMessage): void; static ɵfac: i0.ɵɵFactoryDeclaration<MessageBus, never>; static ɵprov: i0.ɵɵInjectableDeclaration<MessageBus>; }