Tuesday, 15 May 2012

dart - Listen to events on ElementList with no explicit accessor -



dart - Listen to events on ElementList with no explicit accessor -

is possible hear events have no explicit accessor on elementlist?

for illustration can next on single element:

class="lang-dart prettyprint-override">this.queryselector(".js-popover-link").on["on-tap"].listen((event) { print("event triggered"); });

however, next not possible on elementlist returned queryselectorall:

class="lang-dart prettyprint-override">this.queryselectorall(".js-popover-link").on["on-tap"].listen((event) { print("event triggered"); });

is there simple way this?

class="lang-dart prettyprint-override">list<streamsubscription> _subscriptions = <streamsubscription>[]; this.queryselectorall(".js-popover-link") .foreach((e) { _subscriptions.add(e.on["on-tap"].listen((event) { print("event triggered"); })); });

...

class="lang-dart prettyprint-override">_subscriptions.foreach((s) => s.cancel());

dart dart-html

No comments:

Post a Comment