Fluent Provider implements part of Node.js EventEmitter
API. Bellow are implemented interface for both API.
⚠️ Only supported events can be listened on. The provider will throw an error if called with a unsupported event.
Node.js EventEmitter
API
on
off
removeListener
ℹ️ The EventEmitter also provide two Web EventTarget
API addEventListener
and removeEventListener
as alias of on
and off
.
Example:
function accountsChanged(accounts) {
// Handle the new accounts, or lack thereof.
// "accounts" will always be an array, but it can be empty.
}
// start listen to accounts change
conflux.on('accountsChanged', accountsChanged);
// stop listen to accounts change
conflux.off('accountsChanged', accountsChanged);
The implementation detail can be found on Github.
Comments
0 comments
Article is closed for comments.