global functions
There are several global functions which provides the scripter with ways to access information and manipulate behavior on the device.
Functions
- addTrigger
- alert
- back
- call
- carrier
- clean
- delete
- deviceDescription
- eval
- exit
- getScrollCoord
- hidePopup
- home
- href
- isPopupVisible
- load
- loadImage
- mapZoom
- mapZoomLevel
- mapZoomVisible
- parseInt
- pause
- platformRequest
- refresh
- removeImage
- save
- screenHeight
- screenWidth
- select
- setFocus
- setScrollCoord
- showPopup
- sleep
- time
- timeZone
- transparencyOff
- transparencyOn
addTrigger()
Signature:  void addTrigger(key1, function1, ... , keyN, functionN)
| Description | Examples | JIN |
|---|---|---|
| Associates a key stroke to specific function. |
addTrigger("*", someFunction());
|
2.0 |
| Details:In addition to left, right, up, down, and ok other valid triggers are:
left_softkey, right_softkey, space, menu, delete - if the target phone has dedicated buttons for these functions.
The emulator displays a space when a user presses the # key like many Samsung phones. In order to add a Trigger to the pound key you need
to add a trigger using 'space' addTrigger('space',someFunction());
left_softkey, right_softkey and ok triggers will override any assigned command. If a command is assigned when there is also a trigger assigned, the command will never execute although the command text will be displayed. Trigger assignments can be ganged in one call: addTrigger('left_softkey',alert('>left<'),'right_softkey',alert('>right<'),'ok',alert('>ok<')); |
||
alert()
Signature:  void alert(someText)
| Description | Examples | JIN |
|---|---|---|
| Alerts some text to the screen. Unlike JavaScrip's alert(), script execution does not block on this function. | alert('Hello World'); | 2.0 |
| Details: | ||
back()
Signature: void back() and back(numPages)
| Description | Examples | JIN |
|---|---|---|
| Return to the previous screen. You can specify the number of pages to go back using a parameter. | back(); back(3) |
2.0 |
| Details: | ||
call()
Signature: void call(phoneNumber)
| Description | Examples | JIN |
|---|---|---|
| Informs the device to make a phone call. The functionality once the call is made is device dependent. | call('5556172222'); | 2.0 |
| Details: | ||
carrier()
Signature: String carrier()
| Description | Examples | JIN |
|---|---|---|
| Returns the device's carrier. "Sprint" for example. | var carrier = carrier(); | 2.0 |
| Details: | ||
clean()
Signature: void clean(message)
| Description | Examples | JIN |
|---|---|---|
| Used to clear the browsers non-volatile screen cache. Subsequent requests for previously stored content, such as pages, variables, or images will force the browser to request a new page. | clean(); clean('Cleaning...'); |
2.0 |
| Details: | ||
delete()
Signature: void delete(key1, key2, ..., keyN)
| Description | Examples | JIN |
|---|---|---|
| Permanently deletes a stored variable from non-volatile memory. It is more efficient to delete a set of variables. | clean(); clean('Cleaning...'); |
2.0 |
| Details: | ||
deviceDescription()
Signature: String deviceDescription()
| Description | Examples | JIN |
|---|---|---|
| Returns a string description of the device. "Samsung A900" for example. | var deviceDesc = deviceDescription(); | 2.0 |
| Details: | ||
eval()
Signature: Variable eval(evalString)
| Description | Examples | JIN |
|---|---|---|
| Evaluates this string to a value represented by the returned variable. | var listItem3 = eval('document.list.listItem' + 3); | 2.0 |
| Details: | ||
exit()
Signature: void exit()
| Description | Examples | JIN |
|---|---|---|
| Exits the application. | exit() | 2.0 |
| Details: | ||
getScrollCoord()
Signature: int getScrollCoord()
| Description | Examples | JIN |
|---|---|---|
| Returns the integer variable representing the scrollbar's vertical coordinate. | var scrollY = getScrollCoord(); | 2.0 |
| Details: | ||
hidePopup()
Signature: void hidePopup()
| Description | Examples | JIN |
|---|---|---|
| Hides the popup if it is showing. | hidePopup(); | 2.0 |
| Details: | ||
home()
Signature: void home()
| Description | Examples | JIN |
|---|---|---|
| Returns to the "home" screen or first screen loaded in the browser and clears the screen stack. It is advised, although not mandatory, for developers to provide a method for users to return "home" from their pages. | home(); | 2.0 |
| Details: | ||
href()
Signature: void href(URL)
| Description | Examples | JIN |
|---|---|---|
| Loads the page returned from a call to the parameter URL. The URL parameter can be relative to the current context. | href("./demo/loadSomethingElse.jsp"); | 2.0 |
| Details: | ||
isPopupVisible()
Signature: Boolean isPopupVisible()
| Description | Examples | JIN |
|---|---|---|
| Returns a boolean if the popup is visible. This can be helpful when deciding how to logically branch based on a trigger. | var isPopVisible = isPopupVisible(); | 2.0 |
| Details: | ||
load()
Signature: String load(varName)
| Description | Examples | JIN |
|---|---|---|
| Returns a previously stored variable from the file system. | var username = load('userName'); | 2.0 |
| Details: | ||
loadImage()
Signature: void loadImage(url1, url2, ..., urlN)
| Description | Examples | JIN |
|---|---|---|
| Loads the PNG file returned from a call to the parameter URL. The URL parameter can be relative to the current context. | loadImage('http://www.myurl.com/pngs/some.png', './pngs/another.png'); | 2.0 |
| Details: | ||
mapZoom()
Signature: void mapZoom()
| Description | Examples | JIN |
|---|---|---|
| Causes a maps "zoom bar" to toggle between visible and not visible only if a map is present. | mapZoom(); | 2.0 |
| Details: | ||
mapZoomLevel()
Signature: int mapZoomLevel()
| Description | Examples | JIN |
|---|---|---|
| Returns the current "zoom bar" level only if a map is present on the screen. Returns -1 otherwise. | var zoomLevel = mapZoomLevel(); | 2.0 |
| Details: | ||
mapZoomVisible()
Signature: Boolean mapZoomVisible()
| Description | Examples | JIN |
|---|---|---|
| Returns true if the "zoom bar" is visible on the map. Otherwise it returns false. | var isVisible = mapZoomVisible(); | 2.0 |
| Details: | ||
parseInt()
Signature: int parseInt(String)
| Description | Examples | JIN |
|---|---|---|
| Parses a string literal or string variable to an integer variable. | var x = parseInt("100"); var x = "3445"; var y = parseInt(x); |
2.0 |
| Details: | ||
pause()
Signature: void pause()
| Description | Examples | JIN |
|---|---|---|
| Places the application into background or suspended mode. The result of calling this function is device dependent. Some devices do not fully implement the J2ME life cycle (paused, active, destroyed) so the result of calling this function may be the same as calling exit() | pause(); | 2.0 |
| Details: | ||
platformRequest()
Signature: void platformRequest(URL)
| Description | Examples | JIN |
|---|---|---|
| Exits the JIN Browser and makes a HTTP request via the native WAP browser to the specified URL. A preceeding "http://" is not required in the URL. | platformRequest("http://www.where.com"); | 2.0 |
| Details: | ||
refresh()
Signature: void refresh()
| Description | Examples | JIN |
|---|---|---|
| Refreshes the page by making an HTTP request using the last URL. | refresh() | 2.0 |
| Details: | ||
removeImage()
Signature: void removeImage(imgUrl1, imgUrl2, ... , imgUrlN)
| Description | Examples | JIN |
|---|---|---|
| Removes an image from cache and non-volatile memory. This can be useful if a developer is caching several large images that could potential cause a heap overflow. It is more efficient to delete a set of images then to call delete several times on a single image. | removeImage('http://www.myUrl.com/button1.png', 'http://www.myUrl.com/button2.png'); | 2.0 |
| Details: | ||
save()
Signature: void save(varName1, varVal1, varName2, varVal2, ..., varNameN, varValN)
| Description | Examples | JIN |
|---|---|---|
| Saves a variable with the specified name and value to the file system. The parameters can either be literals or variables of type string. It is more efficient to call save once on a set of variables then to call save several times on a single variable. | save('user', userVar, 'phone', phoneVar); | 2.0 |
| Details: | ||
screenHeight()
Signature: int screenHeight()
| Description | Examples | JIN |
|---|---|---|
| Returns the device's screen height. | var height = screenHeight(); | 2.0 |
| Details: | ||
screenWidth()
Signature: int screenWidth()
| Description | Examples | JIN |
|---|---|---|
| Returns the device's screen width. | var width = screenWidth(); | 2.0 |
| Details: | ||
select()
Signature: void select()
| Description | Examples | JIN |
|---|---|---|
| Causes the component with the current focus to have its "onselect" attribute to be called. | select(); | 2.0 |
| Details: | ||
setFocus()
Signature: void setFocus(element)
| Description | Examples | JIN |
|---|---|---|
| Sets the current browser focus to the element only if it accepts focus. | setFocus(document.list); | 2.0 |
| Details: | ||
setScrollCoord()
Signature: void setScrollCoord(yCoord);
| Description | Examples | JIN |
|---|---|---|
| Sets the vertical position of the scrollbar. | setScrollCoord(20); var yCoord = 20; setScrollCoord(yCoord); |
2.0 |
| Details: | ||
showPopup()
Signature: void showPopup()
| Description | Examples | JIN |
|---|---|---|
| Shows the popup component if one is defined. | showPopup(); | 2.0 |
| Details: | ||
sleep()
Signature: void sleep(timeInMillis)
| Description | Examples | JIN |
|---|---|---|
| Causes execution to sleep for "timeInMillis". This is the same as calling Thread.sleep() in Java. | // sleep for 2 secs sleep(2000); |
2.0 |
| Details: | ||
time()
Signature: String time()
| Description | Examples | JIN |
|---|---|---|
| Returns the time in milliseconds since Jan. 1, 1970 00:00:00 GMT as a String. | var timeInMillis = time(); | 2.0 |
| Details: | ||
timeZone()
Signature: String timeZone()
| Description | Examples | JIN |
|---|---|---|
| Returns the time zone of the device as an offset from GMT. For example, in EST, timeZone() would return "GMT-05:00" while in EDT, timeZone() would return "GMT-04:00". | var tz = timeZone(); | 2.0 |
| Details: | ||
transparencyOff()
Signature: void transparencyOff()
| Description | Examples | JIN |
|---|---|---|
| Turns transparency of the screen off. | transparencyOff(); | 2.0 |
| Details: | ||
transparencyOn()
Signature: void transparencyOn(alphaTransparency)
| Description | Examples | JIN |
|---|---|---|
| Creates an alpha transparency on the body of the screen. Layers and the Popup will not be effected by turning transparency on. The high order of bytes determine the opaqueness of the color. A full opaque color is specified as 0xFFRRGGBB and fully transparent color is specified as 0x00RRGGBB specifies a fully transparent color. | transparencyOn(0x99C0C0C0); | 2.0 |
| Details: | ||
For 24/7 support email support@where.com or call 888-262-1150
WHERE™ is a product from uLocate Communications, Inc. ©2007 All Rights Reserved.