Home Reference Source
public class | source

HeadGoverness

Extends:

hookies~HooksPubSubBaseObject → HeadGoverness

Constructor Summary

Public Constructor
public

Creates a new instance of the HeadGoverness

Member Summary

Public Members
public

rules: *

public get

The getter of unguarded property.

public set

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

The governess is empty when no rules have been defined

public

isAllowed(action: *, args: ...*): boolean

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
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 constructor source

Creates a new instance of the HeadGoverness

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 addRule(rules: ...*): * source

Params:

NameTypeAttributeDescription
rules ...*

Return:

*

public doUnguarded(callback: *, context: *): * source

Perform some stuff unguarded

Params:

NameTypeAttributeDescription
callback *
context *

Return:

*

public getRules(type: *): * source

Params:

NameTypeAttributeDescription
type *

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:

NameTypeAttributeDescription
callback *
args *[]
  • optional
  • default: []
callingContext *
  • optional
  • default: null

Return:

*

public guard(action: *, args: ...*): * source

Throws an error if child is not allowed to do some action

Params:

NameTypeAttributeDescription
action *
args ...*

Return:

*

public hasAnyRules(): * source

The governess is empty when no rules have been defined

Return:

*

public isAllowed(action: *, args: ...*): boolean source

Returns true if child is allowed to perform some action

Params:

NameTypeAttributeDescription
action *
args ...*

Return:

boolean

public isGuarded(): * source

Return:

*

public isNotAllowed(args: ...*): * source

Returns false if child is allowed to perform some action

Params:

NameTypeAttributeDescription
args ...*

Return:

*

public isUnguarded(): * source

Return:

*

public learnRules(perimeter: *): * source

Params:

NameTypeAttributeDescription
perimeter *

Return:

*