ARCS logo.js Augmented Reality Component System

Class: Application

ARCS. Application

The application is the master class of the ARCS engine. It is initialized using a structured object (possibly described in JSON, see ARCS.Application#import) to load all external scripts describing components, instanciate all components and then start the application

new Application()

Creates an application runnable by the ARCS engine.
Source:

Methods

<static> setFactory()

Helper function that registers a factory from the global namespace to a given application. This is defined in order to be callable by modules.
Source:

finish()

This is the end my friend. This triggers the end of the application
Source:

import(object)

Imports a structured object describing the application. The structured object may be described itself in a JSON format.
Parameters:
Name Type Description
object object structured object describing an application.
Source:
Example
// JSON format of an application description
{
     context : {
             libraries : [ "library1", "library2"],
             components : [
                     // this could be also properties from context
                     name1: { type: "type", string: "string if needed" }
             ],
             constants : [
                     // the same observation applies here
                     name1: { representation : {JSON/objectRepresentation ? } }
             ]
     },
     controller : controllerId,
     sheets : {
             sheetId : {     
                     preconnections : [
                             { 
                                     destination: "id", 
                                     slot : "slot name",
                                     value : JSON/objectRepresentation ?
                             }, {...}, {...}
                     ],
                     postconnections : [
                             { 
                                     destination: "id", 
                                     slot : "slot name",
                                     value : JSON/objectRepresentation ?
                             }, {...}, {...}
                     ],
                     connections : [
                             {
                                     source: "id",
                                     destination: "id",
                                     slot: "slot name",
                                     signal: "signal name"
                             }, {...}, {...}
                     ],
                     cleanups : [
                             { 
                                     destination: "id", 
                                     slot : "slot name",
                                     value : JSON/objectRepresentation ?
                             }, {...}, {...}
                     ]
             },
             { ... }
     }
}

setFactory(key, factory)

Registers a factory using a key. If a factory was previously existing using the same key, then it is overridden.
Parameters:
Name Type Description
key string name of the factory
factory object component factory to register.
Source:

setSheet(sheetName)

Sets the current sheet of the application. This method is in fact designed as a slot and may be triggered by a statemachine. If a sheet is already the current one, then it is deactivated before activating this new sheet.
Parameters:
Name Type Description
sheetName string name of the sheet to set as a current sheet.
Source:

start()

Starts the application
Source: