ractivejs / ractivejs.github.io

https://ractive.js.org
8 stars 33 forks source link

Update event reference with context #90

Closed kouts closed 7 years ago

kouts commented 7 years ago

Change the first argument from event to ctx, as first argument of event handlers is a context object (ctx)

fskreuz commented 7 years ago

Wondering if a full context would convey the idea better. Not a fan of abbreviations, but that's just me. :D

fskreuz commented 7 years ago

🎉

kouts commented 7 years ago

@fskreuz thanks, can you also check if this is correct: https://ractive.js.org/concepts/#event-context

The context object is a special instance of a context object augmented with additional event-related properties where applicable.

Should this also change to context? https://ractive.js.org/concepts/#stopping-propagation

this.on('ancestorbuttonclick', event => {
      console.log('This will not run')
    })
    this.on('descendantbuttonclick', event => {
      console.log('This will run')
      return false;
    })
fskreuz commented 7 years ago

As far as I know, yes. All events, DOM or component, now supply an instance of Context when using ractive.on to listen for them. As a quick sanity check, I'll pull @evs-chris into the conversation. 😄

kouts commented 7 years ago

@fskreuz I know that, I meant if it's syntactically correct to say:

The context object is a special instance of a context object

fskreuz commented 7 years ago

Ahh... no. That's confusing. 😄 Maybe "the first argument".

kouts commented 7 years ago

@fskreuz could you also please check the example at https://ractive.js.org/concepts/#stopping-propagation I think this also needs changing from event to context am I correct?