Home Reference Source
public class | source

Sandbox

Extends:

hookies~HooksPubSubBaseObject → Sandbox

The definition of Sandbox class. The sandbox is place where children can play governed by a governess.

Constructor Summary

Public Constructor
public

constructor(child: *, objectPattern1: {"governess": *, "perimeters": *})

Create a new empty sandbox.

Member Summary

Public Members
public

child: *

public get

The getter of the governess.

public set

The setter of the governess.

Method Summary

Public Methods
public

getPerimeter(purpose: *): *

Return perimeter by a purpose or null.

public

Return all loaded perimeters

public

guard(args: ...*): *

public

hasPerimeter(perimeter: *): *

Return true if sandbox already contains a perimeter.

public

isAllowed(args: ...*): *

Return true if allowed to do action on target.

public

isNotAllowed(args: ...*): *

Return true if not allowed to do action on target.

public

loadModule(args: ...*): *

Alias for loadPerimeter

public

loadPerimeter(perimeters: ...*): *

Load perimeters.

Inherited Summary

From class PubSub
public

trigger(name: *, args: ...*): *

Trigger all events synchronously by default

public

triggerAsync(args: ...*): *

Trigger asynchronously

Public Constructors

public constructor(child: *, objectPattern1: {"governess": *, "perimeters": *}) source

Create a new empty sandbox.

Params:

NameTypeAttributeDescription
child *
  • optional
  • default: null
objectPattern1 {"governess": *, "perimeters": *}
  • optional
  • default: {}

Public Members

public child: * source

public get governess: * source

The getter of the governess.

public set governess: * source

The setter of the governess. Make sure new governess learn all the rules when governess is set.

Public Methods

public getPerimeter(purpose: *): * source

Return perimeter by a purpose or null.

Params:

NameTypeAttributeDescription
purpose *

Return:

*

public getPerimeters(): * source

Return all loaded perimeters

Return:

*

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

Params:

NameTypeAttributeDescription
args ...*

Return:

*

public hasPerimeter(perimeter: *): * source

Return true if sandbox already contains a perimeter.

Params:

NameTypeAttributeDescription
perimeter *

Return:

*

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

Return true if allowed to do action on target.

Params:

NameTypeAttributeDescription
args ...*

Return:

*

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

Return true if not allowed to do action on target.

Params:

NameTypeAttributeDescription
args ...*

Return:

*

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

Alias for loadPerimeter

Params:

NameTypeAttributeDescription
args ...*

Return:

*

public loadPerimeter(perimeters: ...*): * source

Load perimeters. Returns the count of addded perimeters.

Params:

NameTypeAttributeDescription
perimeters ...*

Return:

*