Skip to content

Commit

Permalink
Add delete method
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Oct 25, 2016
1 parent bddb8f1 commit a30b17b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion js_src/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ m.sync_socket = class sync_socket extends mesh.mesh_socket {
*/
let new_meta = new m.metatuple(this.id, base.getUTC());
let s_key = new Buffer(key);
let s_data = new Buffer(data);
this.__store(s_key, s_data, new_meta);
if (!data) {
this.send([s_key, ''], undefined, base.flags.store);
}
else {
let s_data = new Buffer(data);
this.send([s_key, s_data], undefined, base.flags.store);
}
}
Expand All @@ -196,4 +196,18 @@ m.sync_socket = class sync_socket extends mesh.mesh_socket {
this.set(key, update_dict[key]);
}
}

del(key) {
/**
* .. js:function:: js2p.sync.sync_socket.del(key)
*
* Clears the value at a given key
*
* :param key: The key you wish to look up (must be transformable into a :js:class:`Buffer` )
*
* :raises TypeError: If a key or value could not be transformed into a :js:class:`Buffer`
* :raises: See :js:func:`~js2p.sync.sync_socket.set`
*/
this.set(key);
}
}

0 comments on commit a30b17b

Please sign in to comment.