src code

instance method SpahQL#listen

SpahQL#listen(path, callback) → SpahQL
  • path (String) – A path relative to the items in this set, if you only want to listen for changes on a particular subkey.
  • callback (Function) – A function to be called when the data in this SpahQL set is modified. SpahQL#listen(callback) -> SpahQL
  • callback (Function) – A function to be called when the data in this SpahQL set is modified.

Registers a callback to be triggered when data within this set of results is modified. Note that this method listens for changes on all items in this set:

var db = SpahQL.db(some_data);

// Callback triggered whenever the first item in any array anywhere is modified db.select(“//0”).modified(function() )

// Callback triggered only when a specific array is modified db.select(“//0”).item(0).modified(function() )

Upon modification, the callback will be triggered with arguments:

Returns self.