Show:
Module: proact-dsl

Constructs a ProAct.Registry. It is used to store/create objects that can be referenced or configured using the ProAct.DSL.

ProAct.Registry is part of the proact-dsl module of ProAct.js.

Constructor

ProAct.Registry

()

Methods

get

(
  • name
)
Object

Retrieves an object, stored this registry.

getProviderByName is used to locate the right provider to retrieve the object from.

Parameters:

  • name String

    Name of the object to find.

    It must be in the format '{namespace}:{key}'

Returns:

Object:

The stored object, or null if there was no ProAct.Registry.Provider register for its type or no object registered for the passed name.

getProviderByName

(
  • name
)
Array

Retrieves the right ProAct.Registry.Provider using the name of stored in this ProAct.Registry object, or the name of an object to be stored

Parameters:

  • name String

    The name of storable object.

    It must be in the format '{namespace}:{key}'.

    Here the namespace is the namespace the ProAct.Registry.Provider manages.

Returns:

Array:

The first element in the result is the ProAct.Registry.Provider or undefined if not found.

The second one is the key at which an object is stored or will be stored in the provider.

The third element is an array with options for storing/creating an object passed to the provider using the name string.

make

(
  • name
  • options
  • [...]
)
Object

Creates a new object and stores it in this registry, using the right provider for the creation and configuring it using the DSL passed through the options parameter.

getProviderByName is used to locate the right provider to create the object with.

setup is used to setup the newly created object using the ProAct.DSL

The idea of this method is to create and configure ProAct.Actor objects.

Parameters:

  • name String

    Name of the object to create and store.

    It must be in the format '{namespace}:{key}'

  • options String | Object

    A ProAct.DSL data object or string used to setup the object to be created.

  • [...] #crossLink "ProAct.DSL/run:method" optional

    Arguments to be used by the }{{/crossLink}} method while configuring the newly created object.

Returns:

Object:

The newly created, stored and configured object, or null if there was no ProAct.Registry.Provider register for its type.

register

(
  • namespace
  • provider
)
ProAct.Registers

Registers a ProAct.Registry.Provider for the passed namespace in the registry.

Parameters:

Returns:

ProAct.Registers:

this

setup

(
  • object
  • options
  • args
)
Object

Configures an object to be stored using ProAct.DSL passed through options and DSL arguments.

Example usage:

A ProAct.Stream is passed to the registry for setup with DSL data.

The data passed through the options parameter is

   '<<(s:foo)|map(-)|filter($1)'
 

And the arguments for the DSL machine passed through the args parameter are

   [function (v) {
     return v % 2 === 0;
   }]
 

This means that a ProAct.Stream stored in this registry by the key 'foo' should be set as a source to the passed as the object parameter simple ProAct.Stream.

It also means that for every value comming in the object parameter's stream there should be mapping of negativity and only even values should be passed to it.

So if we trigger in the 'foo' stream the value of 4 in our stream we will get -4, and if we trigger 5, we won't get anything.

Parameters:

  • object Object

    The object to setup.

  • options String | Object

    A ProAct.DSL data object or string used to setup the object.

  • args Array

    Arguments to be used by the ProAct.DSL/run:method method while configuring the passed object.

Returns:

Object:

Ready to strore object.

store

(
  • name
  • object
  • options
  • [...]
)
Object

Stores an object in this registry, using the right provider to configure it using the DSL passed through the options parameter.

getProviderByName is used to locate the right provider to store the object to.

Parameters:

  • name String

    Name of the object to store.

    It must be in the format '{namespace}:{key}'

  • object Object

    The object to store.

  • options String | Object

    A ProAct.DSL data object or string used to setup the object to be stored (optional).

  • [...] #crossLink "ProAct.DSL/run:method" optional

    Arguments to be used by the }{{/crossLink}} method while configuring the object.

Returns:

Object:

The stored and configured object, or null if there was no ProAct.Registry.Provider register for its type.

toObject

(
  • data
)
Object protected

Helper method for transforming a key of stored item in this ProAct.Registry to the actual item or returning the key, if the item is not found in the ProAct.Registry.

Mainly used by the ProAct.DSL logic.

Parameters:

  • data String | Object

    Key of strored object or something else. If the key is valid and there is something stored on it, the stored object is retrieved.

    If there is nothing stored for this data, the data itself is returned.

Returns:

Object:

Stored object, if found using the passed data or the data itself.

toObjectArray

(
  • array
)
Array protected

Helper method for transforming an array of keys of stored items in this ProAct.Registry to an array of the actual items.

Mainly used by the ProAct.DSL logic.

Parameters:

  • array Array

    Array of string keys to objects stored in this registry to be retrieved using toObject.

    If object is not stored on some key, the key itself is returned in the same possition in the result array.

Returns:

Array:

Of the retrieved objects, in the same order as the keys.

Properties

constructor

ProAct.Registry final

Reference to the constructor of this object.