Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added event emitter to send updated tokens.
There were two options here: 1. create the emitter in the application and allow the consumer to use it, or 2. allow the consumer to create the emitter and inject it as a dependency I've built it as option 1, but I'm open to discussion on this. The creation for partner apps would look something like: ``` xeroClient = new xero.PartnerApplication(config); eventReceiver = xeroClient.eventEmitter; eventReceiver.on('xeroTokenUpdate', function(data) { //Store the data that was received from the xeroTokenRefresh event console.log("Received xero token refresh: ", data); }); ``` This is only for partner applications, but it will be required to refresh the emitter every time a new application object is created to ensure the listening stack is shared.
- Loading branch information
Jordan Walsh
committed
Mar 14, 2017
1 parent
804e36e
commit c17877b
Showing
4 changed files
with
101 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters