EXO Object Reference (JavaScript/HTML5)

The exo object is available from all applications running in an EXOPC container (an autonomous application or an applications for a dedicated UI such as EXOdesk).
At startup, the object exo is accessible when the function exomain is called. 
The function is declared as follow:

function exomain() {
     // My application can have access to the exo object now
}






EXO Object Reference (JavaScript/HTML5)


exo.array.insert(array, elementIndex, stringToInsert, mustBeUnique)
Insert an item in an array.


exo.array.remove(array, itemIndex)
Remove an item from an array.


exo.array.indexOf(array, string)
Returns the index of the item egual to string.


exo.activeApp.height
Height of the application at the OS level.


exo.activeApp.left
Left position of the active application at OS level.


exo.activeApp.title
Title of the current active application. The active application is the one who get the input focus on the operating system.


exo.activeApp.top
Top position of the active window at OS level.


exo.activeApp.width
Width of the active application at OS level.


exo.app.args
Arguments passed to the application.
Args can be of any format, including an object.


exo.app.autoMove.speed
Set the speed of the animation when a new size or position is set via exo.app.left, exo.app, top, exo,app.width or exo.app.height.
The default value is 1 (normal speed)
A lower value results in a slower animation, when an higher value results in a faster animation.
The speed is applied only to the movment managed programatically. For any movment due to user input, velocity (speed and friction) is used.


exo.app.beforeMove.left
Left position of the application just before being moved by  the user.


exo.app.beforeMove.top
Top position of the application just before the user move it.


exo.app.close()
Close the application.
If a function was defined with exo.app.onClose, the function is called. If the function returns false, the application is not closed.


exo.app.collisionMap.color
Color representing the application in the shared collision map.


exo.app.collisionMap.cx
Provides an access to the 2d device context of the collision map canvas.
This allows direct drawing on the collision map, for example when the event onPaint is raised.


exo.app.collisionMap.shape
Defines the shape of the application in the collision map.
exo.app.collisionMap.shape = 0 // Rectangle
exo.app.collisionMap.shape = 1 // Ellipse
The size of the shape is the size of the application.
You can draw custom shapes using exo.app.collisionMap.onPaint


exo.app.collisionMap.onPaint
Function name to be called when the collision map needs to be repainted.

In the folowing example, the collision map is set as an rectangles with a 20 pixels margin for improved touch experience.

function exomain() {
     exo.app.collisionMap.onPaint = "collisionMap_paint"
}

function collisionMap_paint() {
     exo.app.collisionMap.cx.fillRect(exo.app.left - 20, exo.app.top - 20, exo.app.width + 40, exo.app.height + 40)
}


exo.app.current.left
Read only - Current left position of the application in the container.
The current position reflects the real position, and the value is updated during animations and transitions.


exo.app.current.top
Current top position of the application in the container.
The current position reflects the real position, and the value is updated during animations and transitions.


exo.app.current.width
Current width of the application in the container.
The current size reflects the real size of the application, and the value is updated during animations and transitions.


exo.app.current.height
Read only - Current height of the application.
The current size reflects the real size, and the value is updated during animations and transitions.


exo.app.countInstances
Number of instances of the application running in the same container  (for example the EXOdesk)


exo.app.delay
Delay before the application is moved to match with a new position or size.


exo.app.friction
The friction defines how fast is the reduction of speed when the application is launched.
The real reduction of speed is based on both the friction of the application and the friction of the container (exo.container.friction)
The default value is 1. A new value can be set as follow:
exo.app.friction = .5
or
exo.app.friction = 2


exo.app.height
Application height


exo.app.id
Unique identifier for the application.
The id is a string. For an application not published on the EXOcloud (generally applications in development phase), the id may not be unique.


exo.app.left
Left position of the application in the container.


exo.app.movable
Set if the application can be moved by the user.
0 or false: the application cannot be moved
1: Default value - the application can be moved horizontally and vertically
2: the application can only be moved horizontally
3: the application can only be moved vertically


exo.app.orientation
Set the orientation of the application.
If the application is composed of multiple HTML tags (not only based on canvas) it is recommanded to use only one of the following values: 0, 90, 180, and 270.


exo.app.onClose
Set a function to be called when the application is about to be closed.
The function can return false to cancel close.
exo.app.onClose = "myAppIsClosing"
...
function myAppIsClosing() {
     return(false) // Prevent the app for being closed
}


exo.app.processId
Returns the unique application process ID.
The process ID is unique within the application container even if several instances of the same application are running.


exo.app.setPosition(left, top [, width, height])
Set the size and position of the application.
The size and position are applied immediatly, without any transition or animation.

This function is useful for example to animate the application from one position to another, as follow:
exo.app.setPosition(sourcePositionX, sourcePositionY)
exo.app.left = targetPositionX
exo.app.top = targetPositionY


exo.app.top
Top position of the application in the container.


exo.app.touch.moverId
Id of the touch point moving the application.


exo.app.touch.count
Number of points of contact over the surface of the application.
See also: exo.touch.count


exo.app.touch.onStart
Event to be raised when the user touch the application.
When mouse compatibiliy mode is enabled (default), this event is also raised with the user press the mouse button when the mouse is over the application.
The mouse compatibility is disabled when touch input is detected.


exo.app.touch.onMove
Raised when a finger move over the application.


exo.app.touch.onEnd
Raised when the finger is released.


exo.app.movingSpeed
true if the application is currently being moved by the user.
This function do not indicate if the application is currently automatically moved.


exo.app.userMovingCancel
Cancel the manual movment of the application.


exo.app.velocity.speed
Speed of the application when launched by the user.
The speed is decreased depending on the friction value of the application (exo.app.friction)
Speed and direction (exo.app.velocity.direction) both define the velocity of the application.


exo.app.velocity.direction
Direction of the movment after an object was moved by the user.
Check exo.app.velocity.speed for more information


exo.app.width
Application width


exo.apps[]
Access to exo.app objects for each running application, privinding an access to all the runtime properties and methods.


exo.apps.installed[]
List of installed applications, available for the current user.
This array can be used to allow the user to launch an application.

for(ptr in exo.apps.installed) {
     if(exo.apps.installed[ptr].id != exo.app.id) { // Do not list the current app
          // Build HTML code here
     }
  }


exo.apps.installed[].id
Id of the application.


exo.apps.installed[].countInstances
Number of instances of the application currently running in the container.


exo.clipboard.setImageFromScreen(x, y, width, height)

Copy to the clipboard the specified area of the screen.
In case of multiple monitors, it is possible to capture an area covering more than one monitor.
The corrdinates are relative to the displays, not to the application container.


exo.clipboard.setImageFromFile(imageFile)
Load an image to make it available to the user via the clipboard.


exo.clipboard.setText()
Set the content of the clipboard with a text string.
The user can then paste it anywhere.


exo.collisionMap.getIndex
Returns the index of the application at the specified coordinates.
exo.collisionMap.getIndex(x, y)


exo.collisionMap.indexToColor(value)
Converts an index into a color to be used for a collision map.
Each index from 0 to 510 matches with an unique color.


exo.collisionMap.paint
Repaint the collision map. This function should generally not be used manually as it is refreshed when any activity is detected on the touch panel.


exo.collisionMap.show()
Shows the collision map, allowing better debbuging.
This feature should only be used for personal use of for tools for developers.


exo.collisionMap.hide()
Hide the collision map. By default, the collision map is hidden, so this function should be used only after a call to exo.collisionMap.show()


exo.collisionMap.visible
Contains true or false if the collision map is visible or not.
Read only. To change the visibility, please check exo.colliisionMap.show() and exo.collisionMap.hide()


exo.container.friction
The friction defines how fast is the reduction of speed when the application is launched.
The real reduction of speed is based on both the friction of the application and the friction of the container (exo.container.friction)
The default value is 1. A new value can be set as follow:
exo.container.friction = .5
or
exo.container.friction = 2


exo.container.height
Height of the container hosting the application.


exo.container.left
Left position of the container in the screen.
The container is the maximum area available for an application.
A fullscreen application will cover the container, when a floatting application will be able to move inside the container.


exo.container.setPosition(x, y, width, height)
Set the position of the container in the screen.
In case of multiple monitor, you can use this function to show the container on a specific monitor - for more information check exo.monitors... 


exo.container.top
Top position of the container in the screen.


exo.container.width
Width of the container hosting the application.


exo.createProcess(appId [, filename [, args]])
Start the specified application in a new process in the same container as the calling application.
Args can be an object or other, and is retreived from the called application with exo.app.args

For example this call:
exo.createProcess(appId, "", Object( {param1:"string", param2:num} ))

From the callee the arguments can be retreived as follow:
exo.app.args.param1 // = "string"
exo.app.args.param2 // = num


exo.createUniqueId()
Returns a 16 charaters unique ID, containing letters and numbers.
id = exo.createUniqueId()


exo.extend(object)
Add methods and properties to an object.
Object can be a canvas 2d context. For more information read the documentation for the object extendedCanvas.


file.load
Loads a text file from disk.
exo.file.load(Filename, callback)
PathAndFile is a string built as follow:
LOCATION:FILE
Location can be RSC or TMP.
A sub-folder can be specified as follow:
LOCATION:folder/FILE
The content of the file is passed as an argument to the callback function.


file.save
Saves a text file to disk.
exo.file.save(PathAndFile, data)


exo.file.open(filename)
Open a file or execute an application located on the user's system.
Filename can be a file or a binary. If the file is not found, the call is simply ignored.

For example, to launch the Windows standard calculator:
exo.file.open("calc.exe")

To open the Window's control panel:
exo.file.open("control.exe")

You can launch office apps as follow (office must be installed prior)
exo.file.open("winword.exe")
exo.file.open("excel.exe")
exo.file.open("powerpnt.exe")
exo.file.open("outlook.exe")
exo.file.open("visio.exe")
exo.file.open("onenote.exe")
exo.file.open("msaccess.exe")

For the application installed on the system, it is not necessary to specify the path.
If you want to launch a specific file or path at a specific, known location, you can specify a full path as follow:
exo.file.open("c:/myFolder/myFile.txt")
Backslash should not be used in the path, use slash instead.

To open a weblink, it is recommanded to use exo.openURL. On Windows, the prefered user browser will be used to display the page instead of Internet Explorer.


exo.monitors[]
Array of objects containing individual information for each monitor connected to the computer.
Using this array it is possible to have the exact map of physical position of each monitor, to set the position of the container, do a screen capture, etc.


exo.monitors.height
Total height of all monitors connected to the computer.


exo.monitors.left
Left position of the first monitor connected to the computer.


exo.monitors.top
Top position of the first monitor connected to the computer.


exo.monitors.width
Total width of all monitors connected to the computer.


exo.monitors.count
Number of monitors connected to the computer.


exo.mouse.x
Returns the horizontal position of the mouse on the screen.
The value can be negative in case of multiple monitors configuration.


exo.mouse.y
Vertical position of the mouse in pixels.
In case of multiple monitors, the value can be negative.


exo.mouse.move(x, y)
Move the mouse cursor relatively to the actual mouse position.


exo.mouse.moveTo(x, y)
Moves the mouse cursor to the specified position (in pixels)


exo.network.ip
IP address of the computer.
Empty string if the IP address is unavailable or unknown.


exo.network.ready
Loading network information can take more time than loading the application, this is why it is useful to test if the network is available before using a network related feature:
if(exo.network.ready) {
     /// Do stuff
}


exo.openURL(URL)
Opens the specified URL using the default web browser.


exo.os.id
Identifiant of the operating system running EXOengine.
The value can be one of the following:
MW = Microsoft Windows
GA = Google Android
AM = Apple MacOS
W = Web


exo.os.version
Version of the OS.
For Windows, the possible values are 7 and 8


exo.ph.getAngle()
Returns the angle in radian between 3 points.
exo.ph.getAngle(x1, y1, x2, y2, x3, y3)


exo.ph.getDistance()
Returns the distance between two points.
exo.ph.getDistance(x1, y1, x2, y2)


exo.ph.degToRad
Value allowing conversions from degre to radian:
deg = rad * exo.ph.degToRad
or from radian to degre:
rad = deg / exo.ph.degToRad

The value of exo.ph.degToRad is Math.PI / 180


exo.ph.createRotationInterface(app, left, top, width, height)
Creates an interface to allow manual rotation of an object.
userRotate = exo.ph.createRotationInterface(exo.app, 0, 0, exo.app.width, exo.app.height)

The following properties and methods are available:
userRotate.angle
userRotate.friction
userRotate.inertia
userRotate.canRotate
userRotate.applyFriction()
userRotate.onStart(touchID)
userRotate.onMove(touchID)
userRotate.onEnd(touchID)


exo.random(min, max)
Returns a random number.


exo.replace(source, toReplace, replaceBy)
Replaces all instances of a string by another one.


exo.sendKey
Send a key to the operating system as if the user pressed a key on the keyboard.
The key can be any character code, character, or one of the following values:
ENTER
TAB
BACKSPACE
SPACE
LEFT
DOWN
UP
BOTTOM
HOME
END
PGUP
PGDOWN
CLICK
RCLICK
The syntax is as follow:
exo.sendKey(keyString,shiftPressed, ctrlPressed)


exo.sendKeys(string)
Emulates the keyboard input of a complete string.


exo.battery.level
Level of charge of the battery.
The value is a number between 0 (uncharged) and 1 (fully charged) 


exo.battery.status
Contains the status of the battery:
0: offline (unplugged, or no battery)
1: online (plugged - charging if exo.battey.level < 1)


exo.system.RAM.total
Total RAM available at the OS level, in kilobytes.


exo.system.RAM.usage
Usage of the random access memory available on the system, expressed in %.


exo.touch[].direction
Direction of the movment of the finger when being moved on the touch panel.


exo.touch[].endOverId
Process id of the application just under the finger when the finger is released from the touch panel.


exo.touch[].moveOverId
Process id of the application under the finger.


exo.touch[].speed
Current speed of the finger when moving over the touch panel.


exo.touch[].points.count
Returns the total number of points reccorded from the moment the finger touched the panel.
exo.touch[touchID].points.count


exo.touch[].points.data[]
Array of objects containing information on individual points of contact. This array is cleared when the finger is released.


exo.touch[].points[].pressure
Pressure level of the specified point.
Pressure is a value between 0 (no contact) to 1 (maximum pressure).


exo.touch[].points[].x
Returns the horizontal position of the specified point.
exo.touch[touchID].points[index].x
To get the horizontal coordinate of the point just before the last known position of the finger, do as follow:
previousTouch = exo.touch[touchID].points.data[exo.touch[touchID].points.count - 1]
alert(previousTouch.x)


exo.touch[].points[].y
Vertical position of the given point.
exo.touch[touchID].points[index].y


exo.touch[].pressure
Pressure, 1 is full pressure, 0 is no pressure.


exo.touch[].startOverId
Process id of the application just under the finger when the finger touch the surface of the touch panel.


exo.touch[].speed
Current speed of the finger when moving over the touch panel.


exo.touch[].x
Returns the last position of the finger specified with touchID.
exo.touch[touchID].x


exo.touch[].y
Last vertical position of the given touch ID.
exo.touch[touchID].y


exo.trim(string)
Returns the string without spaces at the begining and at the end of the string.




© EXOPC 2012 - All rights reserved

No comments:

Post a Comment