23 lines
562 B
TypeScript
23 lines
562 B
TypeScript
/**
|
|
* Abstract base class for all Blockers.
|
|
*
|
|
* Blockers are frontend mechanisms that prevent actions to improve UX.
|
|
* They are not security mechanisms and must be reversible and best-effort.
|
|
*/
|
|
export abstract class Blocker {
|
|
/**
|
|
* Checks if the action can be executed.
|
|
* @returns true if the action can proceed, false otherwise.
|
|
*/
|
|
abstract canExecute(): boolean;
|
|
|
|
/**
|
|
* Blocks the action from being executed.
|
|
*/
|
|
abstract block(): void;
|
|
|
|
/**
|
|
* Releases the block, allowing future executions.
|
|
*/
|
|
abstract release(): void;
|
|
} |