Class

GeneratorBehavior

GeneratorBehavior()

Base class for Generator Behaviors.

For full details on how to use this class, see the Behavior API tutorial.

Constructor

# new GeneratorBehavior()

View Source behaviors/generator-behavior.js, line 10

Methods

# __call__()

Implementation for Callable.

View Source behaviors/generator-behavior.js, line 159

# bind(ayva)

Binds this behavior to the specified Ayva instance.

Not to be confused with Function.prototype.bind(). Although the effect is similar. This affects start(), generate(), iterated(), and when calling this behavior using the shorthand callable syntax.

Parameters:
Name Type Description
ayva Ayva

View Source behaviors/generator-behavior.js, line 110

this behavior

# generator generate(ayvaopt)

Generate the actions that make up this behavior. Subclasses must implement this method.

For full details on how to implement this method, see the Behavior API tutorial.

Parameters:
Name Type Attributes Description
ayva Ayva <optional>

instance of Ayva to generate actions for. Defaults to the Ayva instance bound to this behavior (if it exists).

View Source behaviors/generator-behavior.js, line 58

# generator iterated(ayvaopt, count)

Repeats the actions that make up this behavior the specified number of iterations.

Parameters:
Name Type Attributes Default Description
ayva Ayva <optional>

instance of Ayva to generate actions for. Defaults to the Ayva instance bound to this behavior (if it exists).

count Number 1

the number of iterations

View Source behaviors/generator-behavior.js, line 68

# next(ayva)

Generate and return the next action of this behavior.

Parameters:
Name Type Description
ayva Ayva

defaults to the bound instance (if any)

View Source behaviors/generator-behavior.js, line 143

  • the next action.

# perform(ayvaopt)

Perform one step of this behavior.

Parameters:
Name Type Attributes Description
ayva Ayva <optional>

instance of Ayva to use. Defaults to the Ayva instance bound to this behavior (if it exists).

View Source behaviors/generator-behavior.js, line 80

Promise that resolves when the step is complete.

# unbind()

Unbind this behavior from any Ayva instance.

View Source behaviors/generator-behavior.js, line 128