English | Site Directory

API Summary

This is the complete Gears API. 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

Database module

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

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

Desktop module

Provides an interface for accessing Desktop functionality.

Desktop class
   bool     createShortcut(name, url, icons, [description])

HttpRequest module

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 string responseText
   readonly attribute int    status
   readonly attribute string statusText 

LocalServer module

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      captureFile(fileInputElement, url)
   string    getCapturedFileName(url)
   string    getHeader(url, name)
   string    getAllHeaders(url)
   FileSubmitter createFileSubmitter()
FileSubmitter class
   void      setFileInputElement(htmlElement, url)

Timer module

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 module

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()