ChromeEvent class
An object which allows the addition and removal of listeners for a Chrome event.
class ChromeEvent extends ChromeObject { ChromeEvent(); ChromeEvent.fromProxy(JsObject jsProxy): super.fromProxy(jsProxy); /** * Registers an event listener _callback_ to an event. */ Future addListener() { var completer = new ChromeCompleter.noArgs(); jsProxy.callMethod('addListener', [completer.callback]); return completer.future; } /** * Deregisters an event listener _callback_ from an event. */ Future removeListener() { var completer = new ChromeCompleter.noArgs(); jsProxy.callMethod('removeListener', [completer.callback]); return completer.future; } bool hasListener(dynamic callback) { return jsProxy.callMethod('hasListener', [jsify(callback)]); } bool hasListeners() { return jsProxy.callMethod('hasListeners'); } /** * Registers rules to handle events. * * [eventName] Name of the event this function affects. * * [rules] Rules to be registered. These do not replace previously registered * rules. * * Returns: * Rules that were registered, the optional parameters are filled with values. */ Future<List<Rule>> addRules(String eventName, List<Rule> rules) { var completer = new ChromeCompleter<List<Rule>>.oneArg((e) => listify(e, _createRule)); jsProxy.callMethod('addRules', [eventName, jsify(rules), completer.callback]); return completer.future; } /** * Returns currently registered rules. * * [eventName] Name of the event this function affects. * * [ruleIdentifiers] If an array is passed, only rules with identifiers * contained in this array are returned. * * Returns: * Rules that were registered, the optional parameters are filled with values. */ Future<List<Rule>> getRules(String eventName, [List<String> ruleIdentifiers]) { var completer = new ChromeCompleter<List<Rule>>.oneArg((e) => listify(e, _createRule)); jsProxy.callMethod('getRules', [eventName, jsify(ruleIdentifiers), completer.callback]); return completer.future; } /** * Unregisters currently registered rules. * * [eventName] Name of the event this function affects. * * [ruleIdentifiers] If an array is passed, only rules with identifiers * contained in this array are unregistered. */ Future removeRules(String eventName, [List<String> ruleIdentifiers]) { var completer = new ChromeCompleter.noArgs(); jsProxy.callMethod('removeRules', [eventName, jsify(ruleIdentifiers), completer.callback]); return completer.future; } }
Extends
ChromeObject > ChromeEvent
Constructors
new ChromeEvent() #
Create a new instance of a ChromeObject
, which creates and delegates to
a JsObject proxy.
ChromeEvent();
new ChromeEvent.fromProxy(JsObject jsProxy) #
Create a new instance of a ChromeObject
, which delegates to the given
JsObject proxy.
ChromeEvent.fromProxy(JsObject jsProxy): super.fromProxy(jsProxy);
Properties
Methods
Future addListener() #
Registers an event listener callback to an event.
Future addListener() { var completer = new ChromeCompleter.noArgs(); jsProxy.callMethod('addListener', [completer.callback]); return completer.future; }
Future<List<Rule>> addRules(String eventName, List<Rule> rules) #
Registers rules to handle events.
eventName Name of the event this function affects.
rules Rules to be registered. These do not replace previously registered rules.
Returns: Rules that were registered, the optional parameters are filled with values.
Future<List<Rule>> addRules(String eventName, List<Rule> rules) { var completer = new ChromeCompleter<List<Rule>>.oneArg((e) => listify(e, _createRule)); jsProxy.callMethod('addRules', [eventName, jsify(rules), completer.callback]); return completer.future; }
Future<List<Rule>> getRules(String eventName, [List<String> ruleIdentifiers]) #
Returns currently registered rules.
eventName Name of the event this function affects.
ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are returned.
Returns: Rules that were registered, the optional parameters are filled with values.
Future<List<Rule>> getRules(String eventName, [List<String> ruleIdentifiers]) { var completer = new ChromeCompleter<List<Rule>>.oneArg((e) => listify(e, _createRule)); jsProxy.callMethod('getRules', [eventName, jsify(ruleIdentifiers), completer.callback]); return completer.future; }
bool hasListener(callback) #
bool hasListener(dynamic callback) { return jsProxy.callMethod('hasListener', [jsify(callback)]); }
bool hasListeners() #
bool hasListeners() { return jsProxy.callMethod('hasListeners'); }
Future removeListener() #
Deregisters an event listener callback from an event.
Future removeListener() { var completer = new ChromeCompleter.noArgs(); jsProxy.callMethod('removeListener', [completer.callback]); return completer.future; }
Future removeRules(String eventName, [List<String> ruleIdentifiers]) #
Unregisters currently registered rules.
eventName Name of the event this function affects.
ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are unregistered.
Future removeRules(String eventName, [List<String> ruleIdentifiers]) { var completer = new ChromeCompleter.noArgs(); jsProxy.callMethod('removeRules', [eventName, jsify(ruleIdentifiers), completer.callback]); return completer.future; }
String toString() #
Returns a string representation of this object.
String toString() => jsProxy.toString();