Class: Resource

PodJS.Pod# Resource

Base class for a resource that belongs to a Pod.

This is an inner class bound to the Pod superclass that has access to the internal resource registry that is present in every pod. Pod sub-classes should ensure that all created resources extend from the resource superclass returned by PodJS.Pod#newResource.

new Resource()

Source:

Members

context :PodJS.Pod#ResourceContext

Context containing references to the environment and pod to which this resource is bound.
Type:
Source:

options :object

Options for this resource.
Type:
  • object
Source:

resourceName :string

The name of this resource, unique for the resource type.
Type:
  • string
Source:

resourceType :string

The type of this resource.
Type:
  • string
Source:

scripts :PodJS.Script[]

Scripts associated with this resource.
Type:
  • PodJS.Script[]
Source:

Methods

newScript() → {PodJS.ScriptBuilder}

Create a new PodJS.ScriptBuilder which will build a script attached to this resource.
Source:
Returns:
The ScriptBuilder that will build the script.
Type
PodJS.ScriptBuilder

register(subInstance)

Called by the subclass to complete the registration process once the subclass is fully intialized. Resources will not have tick() called on them or be returned until register() is called.
Parameters:
Name Type Description
subInstance object The instance of the resource that should be registered.
Source:

release()

Release the system resources associated with this resource and remove it from the pod's resource registry.

Sub-classes can optionally override this method, but must always call the super-class to ensure the proper bookkeeping takes place. Note that resources will continue to receive ticks until deleted / released.

Source:

tick()

Gets called periodically by the environment when the next action is to take place.

The super-class version of tick() does nothing. Subclasses can optionally override to perform additional actions on each environment tick.

Source: