API Summary

This is the complete list of Gears APIs. Click the class names to see the details.

Factory

Instantiates all other Gears objects.

Factory class
   Object  create(className, [classVersion])
   string  getBuildInfo()
   boolean getPermission([siteName], [imageUrl], [extraMessage])
   readonly attribute boolean hasPermission
   readonly attribute string  version

Blob

Provides a way to reference binary data.

Blob class
   readonly attribute int length
   int[]   getBytes(offset, length)
Blob slice(offset, length)

BlobBuilder

Provides a way to reference binary data.

BlobBuilder class
   void    append(data)
   Blob    getAsBlob()

Canvas

Provides a way to perform image manipulation.

Canvas class
   readwrite attribute int height
   readwrite attribute int width
   void    crop(x, y, w, h)
   void    decode(blob)
   Blob    encode([mimeType, options])
   void    resize(w, h, [filter])

Database

Provides a SQL database for storing data on the local machine.

Database class
   readonly attribute int lastInsertRowId
   readonly attribute int rowsAffected
   void      open([name])
   ResultSet execute(sqlStatement, [argArray])
   void      close()
   void      remove()
ResultSet class
   boolean isValidRow()
   void    next()
   int     fieldCount()
   string  fieldName(fieldIndex)
   variant field(fieldIndex)
   variant fieldByName(fieldName)
   void    close()

Desktop

Provides an interface for accessing Desktop functionality.

Desktop class
   void    createShortcut(name, url, icons, [description])
   Object  extractMetaData(blob)
   Object  getDragData(event, flavor)
   void    openFiles(callback, [options])
   void    setDropEffect(event, dropEffect)

Geolocation

Provides a way to obtain a user's geographical position.

Geolocation class 
   readonly attribute Position lastPosition
   readonly attribute boolean hasPermission
   void    getCurrentPosition(successCallback, [errorCallback], [options])
   int     watchPosition(successCallback, [errorCallback], [options])
   void    clearWatch(int watchId)
   boolean getPermission([siteName], [imageUrl], [extraMessage])
Position class
   readonly attribute Date    timestamp
   readonly attribute Coords  coords
   readonly attribute Address gearsAddress
   readonly attribute double  latitude
   readonly attribute double  longitude
   readonly attribute double  accuracy
   readonly attribute double  altitude
   readonly attribute double  altitudeAccuracy
PositionOptions class
   readwrite attribute bool     enableHighAccuracy
   readwrite attribute int      maximumAge
   readwrite attribute int      timeout
   readwrite attribute bool     gearsRequestAddress
   readwrite attribute string   gearsAddressLanguage
   readwrite attribute string[] gearsLocationProviderUrls
PositionError class
   readonly attribute int    UNKNOWN_ERROR
   readonly attribute int    PERMISSION_DENIED
   readonly attribute int    POSITION_UNAVAILABLE
   readonly attribute int    TIMEOUT
   readonly attribute int    code
   readonly attribute string message
Coords class
   readonly attribute double latitude
   readonly attribute double longitude
   readonly attribute double accuracy
   readonly attribute double altitude
   readonly attribute double altitudeAccuracy
Address class
   readonly attribute string streetNumber
   readonly attribute string street
   readonly attribute string premises
   readonly attribute string city
   readonly attribute string county
   readonly attribute string region
   readonly attribute string country
   readonly attribute string countryCode
   readonly attribute string postalCode

HttpRequest

Provides the ability to send HTTP requests in workers, as well as on the main page.

HttpRequest class
   void     open(method, url)
   void     setRequestHeader(name, value)
   void     send([postData])
   void     abort()
   string   getResponseHeader(name)
   string   getAllResponseHeaders()
   callback onreadystatechange
   readonly attribute int    readyState
   readonly attribute Blob   responseBlob
   readonly attribute string responseText
   readonly attribute int    status
   readonly attribute string statusText
   readonly attribute HttpRequestUpload upload
HttpRequestUpload class
   callback onprogress(progressEvent)
ProgressEvent class
   readonly attribute int total
   readonly attribute int loaded
   readonly attribute bool lengthComputable

LocalServer

Caches and serves your application's resources locally, making it possible to start a web application without a network connection.

LocalServer class
   boolean              canServeLocally(url)
   ResourceStore        createStore(name, [requiredCookie])
   ResourceStore        openStore(name, [requiredCookie])
   void                 removeStore(name, [requiredCookie])
   ManagedResourceStore createManagedStore(name, [requiredCookie])
   ManagedResourceStore openManagedStore(name, [requiredCookie])
   void                 removeManagedStore(name, [requiredCookie])
ManagedResourceStore class
   readonly  attribute string  name
   readonly  attribute string  requiredCookie
   readwrite attribute boolean enabled
   readwrite attribute string  manifestUrl
   readonly  attribute int     lastUpdateCheckTime
   readonly  attribute int     updateStatus
   readonly  attribute string  lastErrorMessage
   readonly  attribute string  currentVersion
   event void oncomplete(Object details)
   event void onerror(Error error)
   event void onprogress(Object details)
   void      checkForUpdate()
ResourceStore class
   readonly  attribute string  name
   readonly  attribute string  requiredCookie
   readwrite attribute boolean enabled
   int       capture(urlOrUrlArray, callback)
   void      abortCapture(captureId)
   void      remove(url)
   void      rename(srcUrl, destUrl)
   void      copy(srcUrl, destUrl)
   boolean   isCaptured(url)
   void      captureBlob(blob, url, [contentType])
   void      captureFile(fileInputElement, url)
   Blob      getAsBlob(url)
   string    getCapturedFileName(url)
   string    getHeader(url, name)
   string    getAllHeaders(url)
   FileSubmitter createFileSubmitter()
FileSubmitter class
   void      setFileInputElement(htmlElement, url)

Timer

Provides a timer that can be used in workers, as well as on the main page.

Timer class
   int      setTimeout(function, delay)
   int      setTimeout(fullScript, delay)
   int      setInterval(function, delay)
   int      setInterval(fullScript, delay)
   void     clearTimeout(timeoutId)
   void     clearInterval(intervalId)

WorkerPool

Provides the ability to run JavaScript code asynchronously.

WorkerPool class
   callback onmessage(messageText, senderId, [messageObject:{text,sender,origin}])
   callback onerror(errorObject:{message})
   int  createWorker(scriptText)
   int  createWorkerFromUrl(scriptUrl)
   void sendMessage(messageText, destWorkerId)
   void allowCrossOrigin()