Methods
cancel(onCompleteopt)
Cancelling any OnDisconnect#set
, OnDisconnect#update
or OnDisconnect#remove
actions
at current location.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
onComplete |
function |
<optional> |
function called when server has canceled actions. An error can be passed in parameter if something goes wrong. |
Example
// Get a reference to John critical data
var ref = new Webcom("/base/contacts/friends/john/temporary");
ref.onDisconnect().set('I disconnected');
// Cancel the previously event (set() in this case)
ref.onDisconnect().cancel();
remove(onCompleteopt)
Remove data at current location when a disconnection event occurs.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
onComplete |
function |
<optional> |
function called when server has registered remove action. An error can be passed in parameter if something goes wrong. |
Example
// Get a reference to John critical data
var ref = new Webcom("/base/contacts/friends/john/criticalData");
ref.onDisconnect().remove();
set(newValnullable, onCompleteopt)
Set data at current location when a disconnection event occurs.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
newVal |
object | string | number | boolean |
<nullable> |
new value |
onComplete |
function |
<optional> |
function called when server has registered set action. An error can be passed in parameter if something goes wrong. |
Example
// Get a reference to John connected status
var ref = new Webcom("/base/contacts/friends/john/status");
ref.onDisconnect().set('I disconnected');
update(newVal, onCompleteopt)
Update data at current location when a disconnection event occurs.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
newVal |
Object | children to be added |
|
onComplete |
function |
<optional> |
function called when server has registered update action. An error can be passed in parameter if something goes wrong. |
Example
Get a reference to John connected status
var ref = new Webcom("/base/contacts/friends/john/status");
ref.onDisconnect().update({message:'I disconnected'});