Package environment

WEB environment implementation. Provides elementary API zebkit needs to perform an environment specific operations.

public void animate (f)

Request to run a method as an animation task.

public void clearInterval (id)

Clear the earlier started interval calling

  • id <Integer>

    an interval id

public <Object> getHttpRequest ( )

Build HTTP request that provides number of standard methods, fields and listeners:

  • "open(method, url [,async])" - opens the given URL
  • "send(data)" - sends data
  • "status" - HTTP status code
  • "statusText" - HTTP status text
  • "responseText" - response text
  • "readyState" - request ready state
  • "onreadystatechange()" - ready state listener

Returns: <Object>

an HTTP request object

public <HTMLImageElement> loadImage (img, success, [error])

Loads an image by the given URL.

  • img <String | HTMLImageElement>

    an image URL or image object

  • success <Function>

    a call back method to be notified when the image has been successfully loaded. The method gets an image as its parameter.

  • [error] <Function>

    a call back method to be notified if the image loading has failed. The method gets an image instance as its parameter and an exception that describes an error has happened.

Returns: <HTMLImageElement>

an image

 // load image
 zebkit.environment.loadImage("test.png", function(image) {
      // handle loaded image
 }, function (img, exception) {
     // handle error
public <Object> parseJSON (json)

Parse JSON string

Returns: <Object>

parsed JSON as an JS Object

public <Integer> setInterval (cb, time)

Call the given callback function repeatedly with the given calling interval.

  • cb <Function>

    a callback function to be called

  • time <Integer>

    an interval in milliseconds the given callback has to be called

Returns: <Integer>

an run interval id

public <String> stringifyJSON (jsonObj)

Convert the given JS object into an JSON string

  • jsonObj <Object>

    an JSON JS object to be converted into JSON string

Returns: <String>

a JSON string