Instead of telling _get_tags that the callback will always want the
message_id (in addition to the list of that message's tags), use bind
[1] to add that information when we set the _edit_tags callback.
[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
nmbug = {
show: function (message_id) {
- this._get_tags(message_id, this._edit_tags.bind(this));
+ this._get_tags(message_id, this._edit_tags.bind(this, message_id));
},
_get_tags: function (message_id, callback) {
var url = [
if (this.status == 200) {
var tags = JSON.parse(this.response);
console.log('nmbug: got tags', tags);
- callback(message_id, tags);
+ callback(tags);
} else {
throw 'Error fetching ' + url + ' (status ' + this.status + ')';
}