How do you translate this function from javascript to dart?
function addEvtListener (element L, evtName, fn) {return el.addEventListener? El.addEventListener (evtName, fn, false): el.attachEvent ('+' + evtName, fn); } The main issue event name is dynamic. I can clearly call:
el.onclick.listen ((event) => fn (event)); If evtName is a click event, but is there any way in dart? l.on ("click"). Listen (event) = & gt; Fn (incident));
An overview of the various methods of listening for an event in the document of the events class is named :
You will see that you can do both:
New EventStream Provider (evtName) .forTaget (el) listen (F) N); or
el.on [evtName] .listen (fn);
No comments:
Post a Comment