class DatasyncNode : Subscriber
Represents a data node within the tree-like data of a Webcom application.
This class provides basic methods to browse, read, write data nodes, as well as subscribe to some events at a data node. Instances of DatasyncNode are built using the DatasyncManager.node method.
val name: String
Gives the name of the data node represented by this DatasyncNode instance, that is, the key of the last segment of its path. |
|
val path: String
Gives the path of the data node represented by this DatasyncNode instance. |
|
val webcomRef: Webcom |
fun cancelNextDisconnectionAction(): Unit
Cancels any previous write operation on this data node with the DatasyncTime.AtNextDisconnection policy. |
|
fun catchingCancel(function: (WebcomError) -> Unit): Subscriber
Registers a cancellation callback for the next subscription to a callback function. |
|
fun child(path: String): DatasyncNode
Returns a child of this data node specified by a path relative to the data node represented by this DatasyncNode instance. |
|
fun clear(at: DatasyncTime = DatasyncTime.Now, callback: WebcomDoneCallback? = null): Unit
Clears data at this data node asynchronously. fun clear(callback: WebcomDoneCallback): Unit |
|
fun createChild(): DatasyncNode
Returns a child of this data node with a unique key. |
|
operator fun div(path: String): DatasyncNode
Shortcut for child. |
|
fun get(callback: WebcomResultCallback<DatasyncValuable>): Unit
Reads the data at this data node asynchronously. |
|
fun merge(at: DatasyncTime = DatasyncTime.Now, value: Any?, callback: WebcomDoneCallback? = null): Unit
Merges some data with the data at this data node asynchronously. fun merge(value: Any?, callback: WebcomDoneCallback? = null): Unit |
|
fun parent(): DatasyncNode?
Gets the parent data node of this DatasyncNode instance. |
|
operator fun plusAssign(value: Any?): Unit
Shortcut for push. |
|
fun push(value: Any?, callback: WebcomDoneCallback? = null): DatasyncNode
Creates a child of this data node with a unique key and writes a given value at it. |
|
fun runTransaction(transaction: (DatasyncValuable) -> TransactionOperation, callback: WebcomResultCallback<TransactionResult>? = null): Unit
Performs an atomic write operation (or transaction) on this data node. |
|
fun set(at: DatasyncTime = DatasyncTime.Now, value: Any?, callback: WebcomDoneCallback? = null): Unit
Writes some data at this data node asynchronously. fun set(value: Any?, callback: WebcomDoneCallback? = null): Unit |
fun subscribe(type: Child, constraint: Constraint = Constraint.None, callback: (ChildEvent) -> Unit): Subscription
Subscribes to a Child event with a given constraint on this data node and send notifications to a callback function. fun subscribe(type: ValueChanged.WithData, constraint: Constraint = Constraint.None, callback: (ValueChangedWithDataEvent) -> Unit): Subscription
Subscribes to a ValueChanged.WithData event with a given constraint on this data node and send notifications to a callback function. fun subscribe(type: ValueChanged.WithoutData, constraint: Constraint = Constraint.None, callback: (ValueChangedWithoutDataEvent) -> Unit): Subscription
Subscribes to a ValueChanged.WithoutData event with a given constraint on this data node and send notifications to a callback function. |
|
fun subscribeToNotifications(type: Type, expirationDate: Date? = null, cipher: CryptoMethod = CryptoMethod.None, includesRevocation: Boolean = true, callback: WebcomResultCallback<Subscription>): Unit
Subscribes to a type of event on this data node until a given expirationDate and push notifications to the mobile device. fun subscribeToNotifications(type: Type, duration: Duration, cipher: CryptoMethod = CryptoMethod.None, includesRevocation: Boolean = true, callback: WebcomResultCallback<Subscription>): Unit
Subscribes to a type of event on this data node for a given duration and push notifications to the mobile device. |
|
fun subscribeToWebhook(type: Type, identifier: String, context: String, expirationDate: Date? = null, includesRevocation: Boolean = true, callback: WebcomResultCallback<Subscription>): Unit
Subscribes to a type of event on this data node until a given expirationDate and send notifications to a webhook. fun subscribeToWebhook(type: Type, identifier: String, context: String, duration: Duration, includesRevocation: Boolean = true, callback: WebcomResultCallback<Subscription>): Unit
Subscribes to a type of event on this data node for a given duration and send notifications to a webhook. |