Driver.WebSQL Class
Constructor
Driver.WebSQL
()
Item Index
Methods
Properties
Methods
addEvent
-
the
-
a
Adds an event
Parameters:
-
the
Stringevent type
-
a
Functionfunction to add
addEventOnce
-
the
-
a
Adds an event for one execution, then removes it
Parameters:
-
the
Stringevent type
-
a
Functionfunction to add
addEvents
-
literal
Helper to add multiple events at once
Parameters:
-
literal
Objectobject of event types => callbacks
clear
-
[callback]
Delete all the records from the storage
clear(function callback(Error|null))
Parameters:
-
[callback]
Function optional- A callback function that will be invoked after the clear.
clearTimeout
-
handle
this method is used to clear the timeout counter of a request timeout
Parameters:
-
handle
Objectthe timeout handle
destroy
()
chainable
each
-
callback
Run the callback method on all the storage items.
each(function callback(Error|null, String key, String value)
Parameters:
-
callback
Function- A callback function that will handle the results. The callback parameters are (key, value)
exists
-
key
-
callback
Check to see if the given key already exist in the Storage
exists(String key, function callback(Error|null, boolean)
Parameters:
-
key
String- The key of the item we want to check if exits
-
callback
Function- A callback function that will handle the results. The callback parameters are (key, value)
Returns:
fireEvent
-
event
-
arguments
dispatches an event
Parameters:
-
event
Stringtype
-
arguments
Mixedto pass with the event
fireLatchedEvent
-
the
-
arguments
Fires a latched event
Parameters:
-
the
Stringevent type
-
arguments
Mixedto pass with the event
generateError
-
[type]
-
[msg]
-
[original_error]
Generate new Bucket.error object and fires the error event
Parameters:
-
[type]
String optionalBucket.error.TYPES constant.
-
[msg]
String optionalthe error massage we want to display.
-
[original_error]
Object optionalthe original error object
Returns:
get
-
keys
-
callback
Retrieve item or items from the storage.
Parameters:
-
keys
String | Arraywhich key/keys we want to retrieve
-
callback
FunctionA callback function that will handle the results.
Returns:
getAll
-
callback
get all items.
getAll(function callback(Error|null, Object records))
Parameters:
-
callback
Function- A callback function for processing the records
Returns:
getKeys
-
callback
get all keys.
getKeys(function callback(Error|null, Array keys))
Parameters:
-
callback
Function- A callback function for processing the keys
Returns:
getLength
-
cb
returns the number of items in the store
Parameters:
-
cb
Function
Returns:
init
()
protected
This method will be init the Driver.
Any initialization code should be place here
initTimeout
-
[cb]
-
[name]
this method is intended to be used for initializing the timeout counter for the request timeout error
Parameters:
-
[cb]
Function optionalin case we want the timeout error to also trigger a callback
-
[name]
String optionalwhich method initiated the timeout
Returns:
query
-
opts
queries commands to the database
Parameters:
-
opts
Object-
onSuccess
Functioncallback to execute when query is successful
-
onError
Functioncallback to execute when query initiated an error
-
sql
Stringsql to execute
-
sqlArgs
Arrayarguments to send with the query
-
remove
-
keys
-
[callback]
Remove items from the storage
Parameters:
-
keys
String | Array- The key(s) of the item we want to remove
-
[callback]
Function optional
Example:
remove(String|Array [, function(Error|null)]) - remove the given key(s) from the storage
removeEvent
-
event
-
function
removes a function from an event
Parameters:
-
event
Stringtype
-
function
Functionto remove from stack
set
-
key
-
[value]
-
[cb]
Add a new item(s) to the storage. If the key is already in the store it will be updated.
Parameters:
-
key
String | Objectif string, will be used as a key name. If object, will be used as a key=>value map
-
[value]
String optionalkey value (only used in case of singular set)
-
[cb]
Function optionalwill be called when action is done
setOptions
-
options
Parameters:
-
options
Object
test
()
Test method to check if this driver is suitable for this browser/device
Returns:
Properties
bound
Object
protected
holds the generated bound function collection
defaultOptions
Object
protected
contains a list of default options for the driver
name
String
The driver name.
prefix
String
protected
The storage prefix to allow same keys from different components.