How to get "template event" via JS event in Google Polymer?

I hope I can explain this :)

If I attach an event listener via template:

<some-node on-event='{{ eventHandler }}'>

      

I get the function signature:

function eventHandler( ev, data, node ){

      

However, if I attach it via JS:

this.$.someNode.addEventListener( 'event', this.eventHandler.bind( this ) );

      

I do not receive data

or node

, only event:

function eventHandler( ev );

      

I understand that this data is available through ev.detail

and ev.path

, but it's annoying to keep track of how I bind an event to determine the data I receive. Is there a way to bind an event in Polymer that will naturally expand the event object into a signature ev, data, node

?

+3


source to share





All Articles