Skip to content

Commit

Permalink
Support provider.once (#1123)
Browse files Browse the repository at this point in the history
* support provider.once

* Fix typo
  • Loading branch information
Bruno Barbieri authored Oct 1, 2019
1 parent c6d13b4 commit 09f9c57
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/core/InpageBridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,18 @@ class InpageBridge {
this.events[event].push(listener);
}

/**
* Simulate the once event to keep parity with the EventEmitter interface
* because there are some dapps that use it
*
* @param {string} event - Event name
* @param {Function} listener - Callback invoked when event triggered
* @returns {InpageBridge}
*/
once(event, listener) {
this.on(event, listener);
}

/**
* Remove a listener for a specific event
*
Expand Down

0 comments on commit 09f9c57

Please sign in to comment.