Skip to content

Commit

Permalink
Add Subscription.forget external id
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed Feb 29, 2016
1 parent 3449ea6 commit a0872ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var property = Object.defineProperty;
Proxy.COMMANDS = [
['exec', 0, 'Async'],
['del', -1],
['hdel', 1],
['hget', 1],
['hgetall', 1],
['hset', 1],
Expand Down
13 changes: 13 additions & 0 deletions lib/subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ Subscription.remember = function (library, plugin, key, id) {
return this.db.hset([plugin, library].join(':'), key, id);
};

/**
* Forgets a Zotero item's external id for a given plugin.
*
* @return {Promise<String>}
*/
Subscription.forget = function (library, plugin, key) {
return this.db.hdel([plugin, library].join(':'), key);
};


/**
* Creates a new Subscription from the passed-in
Expand Down Expand Up @@ -500,6 +509,10 @@ Subscription.prototype.remember = function (plugin, key, id) {
return Subscription.remember(this.library, plugin, key, id);
};

Subscription.prototype.forget = function (plugin, key) {
return Subscription.forget(this.library, plugin, key);
};

Subscription.prototype.reset = function () {
this.version = 0;
this.versions = {};
Expand Down

0 comments on commit a0872ec

Please sign in to comment.