Ionic-framework: Prepend ion to every custom event emitted

Created on 18 May 2016  路  7Comments  路  Source: ionic-team/ionic-framework

Right now we are using the same names as native events. This is causing issues with event bubbling and we think it is confusing that we don't differentiate between what a native event is and what our custom events are. Also, there are times we override the native events which isn't good.

We're going to rename all custom events so they begin with ion, so where we have:

<ion-tabs (change)="onChange($event)">

it will be

<ion-tabs (ionChange)="tabsChange($event)">

Most helpful comment

We decided to go back to using ion instead of the component name, since this API is easier because the user doesn't have to look up each event name to know which one to use.

All 7 comments

Can we prepend with the component name instead? (tabChange) vs (ionChange)

@mlynch Updated the issue to reflect the change to component names instead of ion.

List of event name changes:

  • Checkbox

    • change -> ionChange

  • DateTime

    • change -> ionChange

    • cancel -> ionCancel

  • InfiniteScroll

    • infinite -> ionInfinite

  • Menu

    • opening -> ionDrag

    • opened -> ionOpen

    • closed -> ionClose

  • Option

    • select -> ionSelect

  • Picker

    • change -> ionChange

  • RadioButton

    • select -> ionSelect

  • RadioGroup

    • change -> ionChange

  • Refresher

    • refresh -> ionRefresh

    • pulling -> ionPull

    • start -> ionStart

  • Searchbar

    • input -> ionInput

    • blur -> ionBlur

    • focus -> ionFocus

    • cancel -> ionCancel

    • clear -> ionClear

  • Segment

    • change -> ionChange

    • select -> ionSelect

  • Select

    • change -> ionChange

    • cancel -> ionCancel

  • Slides

    • willChange -> ionWillChange

    • didChange -> ionDidChange

    • move -> ionDrag

  • TabButton

    • select -> ionSelect

  • Tab

    • select -> ionSelect

  • Tabs

    • change -> ionChange

  • Toggle

    • change -> ionChange

For menus, let's rename them to menuOpen and menuClose. I think they had ed at the end so it wasn't stepping on something else to begin with.

For Platform let's not rename them since they're not on an element and wouldn't bubble up.

Can't say infiniteScrollLoading is overly awesome, but for consistency reasons it makes sense.

Overall looks good to go 馃憤

Actually, should we have menuWillOpen, menuDidOpen and menuWillClose, menuDidClose?

What about infiniteScrollStart similar to refresher? We could have menuDidOpen and menuDidClose but we would have to add events for the others. Not a bad idea actually.

We decided to go back to using ion instead of the component name, since this API is easier because the user doesn't have to look up each event name to know which one to use.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GeorgeAnanthSoosai picture GeorgeAnanthSoosai  路  3Comments

brandyscarney picture brandyscarney  路  3Comments

masimplo picture masimplo  路  3Comments

giammaleoni picture giammaleoni  路  3Comments

danbucholtz picture danbucholtz  路  3Comments