Class: SimpleContext

olympe.df. SimpleContext

A Simple Execution Context. It can be used for controlling the life cycle of data-flows.


new SimpleContext( [name] [, parent])

Creates a simple execution context with optional name and parent.

Parameters:
Name Type Argument Default Description
name string <optional>
'SimpleContext'

The debug name for this context.

parent olympe.df.ExecutionContext <optional>
<nullable>

The parent context. Default is current executing context. 'null' for no parent.

Implements:

Members


<static> debugIndent

DEVONLY


<protected> debug :boolean

Type:
  • boolean

offChildrenCreationContextChanged :function

Type:
  • function
Deprecated:
  • For backward compatibility only. Use onDetachAll instead.

onChildrenCreationContextChanged :function

Type:
  • function
Deprecated:
  • For backward compatibility only. Use onDetachAll instead.

Methods


attach(nodeOrProxy)

Attaches a node, or context, to this context.

Parameters:
Name Type Description
nodeOrProxy olympe.df.ExecutionContext | olympe.df.Proxy

The node to attach to this context.

Implements:

boundTo(func)

Creates a function that is the result of binding the specified function to this context. This means that all nodes created during any execution of the created function will be attached to this context or one of its descendents.

Parameters:
Name Type Description
func T

The function to bind to this context.

Implements:
Returns:

The created function.

Type
T

contextIsDetaching(context)

Notify this context that it is being detached from its parent.

Parameters:
Name Type Description
context olympe.df.ExecutionContext
Implements:

destroy()

Destroy this context and all its dependents.

Implements:

detach(nodeOrProxy [, autoDestroy])

Detaches a node from this context. If autoDestroy is true (the default), then the detached node might be garbage collected if there aren't any nodes left depending on its value.

Parameters:
Name Type Argument Default Description
nodeOrProxy olympe.df.ExecutionContext | olympe.df.Proxy

The node to detach.

autoDestroy boolean <optional>
true

true to destroy if garbage collection conditions are met, false to keep no matter what.

Implements:

detachAll()

Detaches all nodes in this context, and checks whether the nodes should be garbage collected.

Implements:

getChildren()

Returns the children attached to this context.

Implements:
Returns:

The map of the children.

Type
Map.<string, !olympe.df.ExecutionContext>

getDebugName()

Gets the debug name for this ExecutionContext.

Implements:
Returns:

The debug name.

Type
string

getId()

Returns the ID for this context.

Implements:
Returns:

The ID.

Type
string

getParent()

Returns the parent context for this context, or null if doesn't have one.

Implements:
Returns:

The parent context.

Type
olympe.df.ExecutionContext

isDestroyed()

Checks whether this context has been already destroyed.

Implements:
Returns:

true if this context has been destroyed.

Type
boolean

isDestroying()

Checks whether this context is in the process of being destroyed.

Implements:
Returns:

true if this context is being destroyed.

Type
boolean

offDestroy(id)

Unregisters a specific callback previously registered with onDestroy.

Parameters:
Name Type Description
id string

The ID of the callback to unregister.

Implements:

offDetachAll(id)

Unregisters a specific callback previously registered with onDetachAll.

Parameters:
Name Type Description
id string

The ID of the callback to unregister.

Implements:

onDestroy(callback [, id])

Registers a callback to be executed when this context is destroyed.

Parameters:
Name Type Argument Description
callback function

The callback to register.

id string <optional>

The ID for this callback. If omitted, it will be automatically generated.

Implements:
Returns:

The ID for the registered callback.

Type
string

onDetachAll(callback [, id])

Registers a callback to be executed when children are being detached from this context.

Parameters:
Name Type Argument Description
callback function

The callback to register.

id string <optional>

The ID for this callback. If omitted, it will be automatically generated.

Implements:
Returns:

The ID for the registered callback.

Type
string

<protected> print()

Gets a string representation of the node, useful for debugging.

Returns:
Type
string

run(func, args)

Execute a function within this context. This means all nodes created during that execution will be attached to this context or one of its descendents.

Parameters:
Name Type Argument Description
func function

The function to execute.

args * <repeatable>

The arguments to pass to the function.

Implements:
Returns:

The return value of the the function.

Type
T | undefined

setParent(context)

Sets the parent context for this context, or null if it should be un-attached. This will automatically detach from previous parent and attach to the new one.

Parameters:
Name Type Argument Description
context olympe.df.ExecutionContext <nullable>

The parent context, or null.

Implements: