ARCS logo.js Augmented Reality Component System

Class: Application

Application

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

Constructor

new Application()

Creates an application runnable by the ARCS engine.

Methods

export()

Exports an object representing an application

finish()

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

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.
Example
// JSON format of an application description
{
     context : {
             libraries : [ "library1", "library2"],
             components : [
                     // this could be also properties from context
                     name1: { type: "type", value: "value 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.

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. This method may warn that it is trying to activate a hollow sheet. It is not inherently an error by itself but it may indicate a problem in your application.
Parameters:
Name Type Description
sheetName string name of the sheet to set as a current sheet.

start()

Starts the application