Package environment

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





Classes:
public void animate (f)

Request to run a method as an animation task.


Parameters:
public void clearInterval (id)

Clear the earlier started interval calling


Parameters:
  • 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.


Parameters:
  • 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


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

Parse JSON string


Parameters:
Returns: <Object>

parsed JSON as an JS Object

public <Integer> setInterval (cb, time)

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


Parameters:
  • 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


Parameters:
  • jsonObj <Object>

    an JSON JS object to be converted into JSON string


Returns: <String>

a JSON string