@freemework/common
Version:
Common library of the Freemework Project.
28 lines (27 loc) • 1.33 kB
TypeScript
import { FChannelEvent } from "./FChannelEvent.js";
import { FChannelEventBase } from "./FChannelEventBase.js";
/**
* @example
* //
* // Following example shown how to use the Mixin class.
* // SomeEventSource is a general class that extends from another class, so it
* // is impossible to inherit FChannelEventImpl (due to not supported class
* // multiple inheritance). By the way we may use Mixin approach...
* //
* class SomeEventSource extends Something {
* protected onAddFirstHandler(): void { } // define in needed
* protected onRemoveLastHandler(): void { } // define in needed
*
* public async someActivity(executionContext: FExecutionContext): Promise<void> {
* const eventData: BroadcastMessage = {};
* await this.notify(executionContext, { data: eventData }); // Call all registered callbacks.
* // Here we guaranteed all consumers processed the message without exceptions.
* }
* }
* interface SomeEventSource extends FChannelEventMixin<ApplicationPageContext> { }
* FChannelEventMixin.applyMixin(SomeEventSource);
*/
export declare class FChannelEventMixin<TData = Uint8Array, TEvent extends FChannelEvent.Event<TData> = FChannelEvent.Event<TData>> extends FChannelEventBase<TData, TEvent> {
static applyMixin(targetClass: any): void;
private constructor();
}