app

The application root.

Summary
app
Preference Dialog
CommentsNote: In addition to customizing background properties, this preference dialog allows you to include additional Javascript and CSS files.
Properties
pref.rint [0, 255], ( r, w )
pref.gint [0, 255], ( r, w )
pref.bint [0, 255], ( r, w )
pref.backgroundImagestring, ( r, w )
pref.backgroundPositionstring, ( r, w )
pref.backgroundRepeatstring, ( r, w )
pref.backgroundAttachmentstring, ( r, w )
dropletsarray of objects, ( r, w )
fullScreenbool, ( r, w )
mergeScenestring, ( r, w )
Functions
addDroplet
refresh
include
findDroplet
findNextDroplet
findNextVisibleDroplet
dispatchEvent
dispatchEventWithData
dispatchEventToTargets
dispatchEventToTargetsWithData
loadPage
loadMolecule
loadDroplet
loadFormation
importDroplet
importFormation
importDropletRaw
importFormationRaw
serialize
clear

Preference Dialog

Comments

Note: In addition to customizing background properties, this preference dialog allows you to include additional Javascript and CSS files.  To add them, simply drag files from your vault and drop them in their respective box.  Or you can click on the plus sign and type in their URLs directly.

For example, to add vector graphic collision detection capability to your app, your can simply add box2d’s build files into your vault and then include them here.

Properties

pref.r

int [0, 255], ( r, w )

Specifies the RED component of the background color.

pref.g

int [0, 255], ( r, w )

Specifies the GREEN component of the background color.

pref.b

int [0, 255], ( r, w )

Specifies the BLUE component of the background color.

pref.backgroundImage

string, ( r, w )

Specifies the URL to a background image.

pref.backgroundPosition

string, ( r, w )

Specifies the position of the background image.  If you specify only one keyword, the second value is default to “center”.  Default value: 0% 0%.

top leftimage at top left corner.
top centerimage at top center.
top rightimage at top right corner.
center leftimage at center left.
center centerimage at center.
center rightimage at center right.
bottom leftimage at bottom left corner.
bottom centerimage at bottom center.
bottom rightimage at bottom right corner.
x% y%The first value is the horizontal position and the second value is the vertical.  The top left corner is 0% 0%.  The right bottom corner is 100% 100%.  If you only specify one value, the other value is default to 50%.
xpos yposThe first value is the horizontal position and the second value is the vertical.  The top left corner is 0 0.  Units can be pixels (0px 0px) or any other CSS units.  If you only specify one value, the other value is default to 50%.  You can mix % and positions.

pref.backgroundRepeat

string, ( r, w )

Specifies how the background image is repeated.

repeatThe background image is repeated vertically and horizontally.
repeat-xThe background image is repeated horizontally.
repeat-yThe background image is repeated vertically.
no-repeatDefault.  The background-image is displayed only once.

pref.backgroundAttachment

string, ( r, w )

Specifies whether a background image is fixed or scrolls with the rest of the page.

scrollDefault.  The background image moves when the rest of the page scrolls.
fixedThe background image does not move when the rest of the page scrolls.

droplets

array of objects, ( r, w )

An array of droplets.  Allows for the access of individual droplet in an app by index.  (e.g. app.boxes[3]).

fullScreen

bool, ( r, w )

Get/Set the application’s full screen mode.

mergeScene

string, ( r, w )

If set, any imported droplet containing a 3D scene is merged into the same scene with the given name.

Functions

addDroplet

addDroplet(droplet, x, y);

Add a droplet to this document at location (x, y).

Parameters

droplet(object) a droplet.
x(int) x-coordinate in pixel.
y(int) y-coordinate in pixel.

Returns

N/A

refresh

refresh();

Force app to redraw with the current set of properties.

Parameters

N/A

Returns

N/A

include

include: function(filename)
include(path);

Load a remote Javascript or CSS file at runtime.  Use the include.loaded event to detect completion, where input params is the given path.

Parameters

path(string) vault or HTTP path to the file.

Returns

N/A

findDroplet

findDroplet(x, y);

Returns the droplet at document location (x, y).

Parameters

x(int) x-coordinate in pixel.
y(int) y-coordinate in pixel.

Returns

(object) a droplet.

findNextDroplet

findNextDroplet(x, y, z);

Returns the droplet at document location (x, y) and has z-index value less than z.

Parameters

x(int) x-coordinate in pixel.
y(int) y-coordinate in pixel.
z(int) z-index value.

Returns

(object) a droplet.

findNextVisibleDroplet

findNextVisibleDroplet(x, y, z);

Returns the visible droplet at location (x, y) and has z-index value less than z.

Parameters

x(int) x-coordinate in pixel.
y(int) y-coordinate in pixel.
z(int) z-index value.

Returns

(object) a droplet.

dispatchEvent

dispatchEvent: function(evt_name)
dispatchEvent(event_name);

Dispatches a custom DOM event with the given event name to this document.

Parameters

event_name(string) event name.

Returns

N/A

dispatchEventWithData

dispatchEventWithData: function(evt_name,
data_name,
data)
dispatchEventWithData(event_name, obj_name, obj);

Dispatches a custom DOM event with the given event name and a data object with the given name to this document.  The receiver of the event can use params[obj_name] to access passed data in a script molecule.

Parameters

event_name(string) event name.
obj_name(string) data object name.
obj(object) data object.

Returns

N/A

dispatchEventToTargets

dispatchEventToTargets: function(targets,
evt_name)
dispatchEventToTargets(targets, event_name);

Dispatches a custom DOM event with the given event name to a group of droplets whose names are given in an input array.

Parameters

targets(array of string) array of droplet names.
event_name(string) event name.

Returns

N/A

dispatchEventToTargetsWithData

dispatchEventToTargetsWithData: function(targets,
evt_name,
data_name,
data)
dispatchEventToTargetsWithData(targets, event_name, obj_name, obj);

Dispatches a custom DOM event with the given event name and a data object with the given name to a group of droplets whose names are given in an input array.  The receiver of the event can use params[obj_name] to access passed data in a script molecule.

Parameters

targets(array of string) array of droplet names.
event_name(string) event name.
obj_name(string) data object name.
obj(object) data object.

Returns

N/A

loadPage

loadPage: function(url)
loadPage(url);

Loads the given url.

Parameters

url(string) a valid http URL or a private vault URL starting with //.

Returns

N/A

loadMolecule

loadMolecule: function(data)
loadMolecule(json);

Loads a molecule in its serialized JSON format into the document.  The returned molecule can then be attached to a droplet.

Parameters

json(string) json representation of a molecule.

Returns

(object) a molecule.

loadDroplet

loadDroplet: function(data,
x,
y,
b)
loadDroplet(json, x, y, b);

Loads a droplet in its serialized JSON format into the document at location (x, y) and set its hideonload attribute to b.

Parameters

json(string) json representation of a droplet.
x(int) x-coordinate of the document.
y(int) y-coordinate of the document.
b(bool) specifies if droplet is hidden on load.

Returns

(object) a droplet.

loadFormation

loadFormation: function(data,
b)
loadFormation(json, b);

Loads a formation (multiple droplets) in its serialized JSON format into the document and set all of its droplets’ hideonload attribute as b.

Parameters

json(string) json representation of a formation.
b(bool) specifies if droplets are hidden on load.

Returns

N/A

importDroplet

importDroplet: function(url,
x,
y,
b)
importDroplet(url, x, y, b, callback);

Imports a droplet from the given URL into the document at location (x, y) and sets its hideonload attribute as b.

Parameters

url(string) a valid http URL or a private vault url starting with //.
x(int) x-coordinate of the document.
y(int) y-coordinate of the document.
b(bool) specifies if droplet is hidden on load.
callback(function) if provided, this becomes asynchronous operation and, on completion, callback is called with the requesting url.

Returns

N/A

importFormation

importFormation: function(url,
b)
importFormation(url, b, callback);

Imports a formation (multiple droplets) from the given URL into the document and set all of its droplets’ hideonload attribute as b.

Parameters

url(string) a valid http URL or a private vault url starting with //.
b(bool) specifies if droplets are hidden on load.
callback(function) if provided, this becomes asynchronous operation and, on completion, callback is called with the requesting url.

Returns

N/A

importDropletRaw

importDropletRaw: function(url)
importDropletRaw(url, callback);

Retrieves the droplet at the given URL in its serialized JSON string format.

Parameters

url(string) a valid http URL or a private vault url starting with //.
callback(function) if provided, this becomes asynchronous operation and, on completion, callback is called with the requesting url and the raw data.

Returns

(string) JSON representation of a droplet.

importFormationRaw

importFormationRaw: function(url)
importFormationRaw(url, callback);

Retrieves the formation (multiple droplets) from the given URL in its serialized JSON string format.

Parameters

url(string) a valid http URL or a private vault url starting with //.
callback(function) if provided, this becomes asynchronous operation and, on completion, callback is called with the requesting url and the raw data.

Returns

(string) JSON representation of a formation.

serialize

serialize: function()
serialize();

Serialize this document into its JSON representation.

Parameters

N/A

Returns

(string) JSON representation of a formation.

clear

clear: function()
clear();

Clear all content from the current document.

Parameters

N/A

Returns

N/A

include: function(filename)
dispatchEvent: function(evt_name)
dispatchEventWithData: function(evt_name,
data_name,
data)
dispatchEventToTargets: function(targets,
evt_name)
dispatchEventToTargetsWithData: function(targets,
evt_name,
data_name,
data)
loadPage: function(url)
loadMolecule: function(data)
loadDroplet: function(data,
x,
y,
b)
loadFormation: function(data,
b)
importDroplet: function(url,
x,
y,
b)
importFormation: function(url,
b)
importDropletRaw: function(url)
importFormationRaw: function(url)
serialize: function()
clear: function()
Close