blockers
This commit is contained in:
23
apps/website/lib/blockers/Blocker.ts
Normal file
23
apps/website/lib/blockers/Blocker.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
Reference in New Issue
Block a user