Skip to content

Commit

Permalink
Provide a 'change' event to JX.Tokenizer
Browse files Browse the repository at this point in the history
Summary: Provide an event like a 'change' event for <select />. The concrete
motivation for this is that we want to update the preview panel in Differential
and Maniphest when a user is executing an "Add Reviewers..." or "Add CCs..."
action and changes the users they're adding.

Test Plan: Installed a JX.Tokenizer listener for 'change', got events when I
altered the value of the tokenizer.

Reviewers: vrana, cpojer, aran, tomo, mroch

Reviewed By: cpojer

CC: aran, epriestley, cpojer

Differential Revision: https://secure.phabricator.com/D1280
  • Loading branch information
epriestley committed Dec 24, 2011
1 parent 713f1fc commit f25470d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib/control/tokenizer/Tokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ JX.install('Tokenizer', {
this._containerNode = containerNode;
},

events : [
/**
* Emitted when the value of the tokenizer changes, similar to an 'onchange'
* from a <select />.
*/
'change'],

properties : {
limit : null,
nextInput : null
Expand Down Expand Up @@ -247,6 +254,8 @@ JX.install('Tokenizer', {

root.insertBefore(token, focus);

this.invoke('change', this);

return true;
},

Expand Down Expand Up @@ -336,6 +345,9 @@ JX.install('Tokenizer', {
delete this._tokenMap[index];
this._redraw(true);
this.focus();

this.invoke('change', this);

return true;
},

Expand Down

0 comments on commit f25470d

Please sign in to comment.