import HeadGoverness from 'kindergarten/src/kindergarten/governesses/HeadGoverness.js'
HeadGoverness
Extends:
Direct Subclass:
Constructor Summary
Public Constructor | ||
public |
Creates a new instance of the HeadGoverness |
Member Summary
Public Members | ||
public |
rules: * |
|
public get |
unguarded: * The getter of unguarded property. |
|
public set |
unguarded: * The setter of unguarded property. |
Method Summary
Public Methods | ||
public |
addRule(rules: ...*): * |
|
public |
doUnguarded(callback: *, context: *): * Perform some stuff unguarded |
|
public |
getRules(type: *): * |
|
public |
governed(callback: *, args: *[], callingContext: *): * Watch over some child action. |
|
public |
guard(action: *, args: ...*): * Throws an error if child is not allowed to do some action |
|
public |
hasAnyRules(): * The governess is empty when no rules have been defined |
|
public |
Returns true if child is allowed to perform some action |
|
public |
isGuarded(): * |
|
public |
isNotAllowed(args: ...*): * Returns false if child is allowed to perform some action |
|
public |
isUnguarded(): * |
|
public |
learnRules(perimeter: *): * |
Inherited Summary
From class PubSub | ||
public |
trigger(name: *, args: ...*): * Trigger all events synchronously by default |
|
public |
triggerAsync(args: ...*): * Trigger asynchronously |
Public Constructors
Public Members
public rules: * source
public get unguarded: * source
The getter of unguarded property. If governess is ungarded, then no errors will be thrown when guard() method is called.
public set unguarded: * source
The setter of unguarded property. If governess is ungarded, then no errors will be thrown when guard() method is called.
Public Methods
public doUnguarded(callback: *, context: *): * source
Perform some stuff unguarded
Params:
Name | Type | Attribute | Description |
callback | * | ||
context | * |
Return:
* |
public governed(callback: *, args: *[], callingContext: *): * source
Watch over some child action. By default we only execute it, but custom
governesses can override it to do some custom stuff like calling guard()
or something else (see. StrictGoverness
class).
Params:
Name | Type | Attribute | Description |
callback | * | ||
args | *[] |
|
|
callingContext | * |
|
Return:
* |
public guard(action: *, args: ...*): * source
Throws an error if child is not allowed to do some action
Params:
Name | Type | Attribute | Description |
action | * | ||
args | ...* |
Return:
* |
public isAllowed(action: *, args: ...*): boolean source
Returns true if child is allowed to perform some action
Params:
Name | Type | Attribute | Description |
action | * | ||
args | ...* |
public isNotAllowed(args: ...*): * source
Returns false if child is allowed to perform some action
Params:
Name | Type | Attribute | Description |
args | ...* |
Return:
* |
public learnRules(perimeter: *): * source
Params:
Name | Type | Attribute | Description |
perimeter | * |
Return:
* |