-
-
Notifications
You must be signed in to change notification settings - Fork 7
Proposal: remove created event
#48
-
Core currently emits a created event in the ViewBase constructor, however this is not used within core, and using it in user code is not all that useful either because it's emitted before you get a chance to add a listener, so essentially you can't directly listen to the created event on a view. The only way to listen to it is through global listeners, ie.:
Observable.on('created', (args) => { console.log('created', args.object) })
Since this fires in the constructor, you don't have access to the view id, only the _domId.
Proposal: remove this event from core, it seems useless and only adds a slight overhead to all view creation.
If you know a valid use-case for why we should keep this, please comment here!
/cc @NativeScript/tsc
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
I say remove it. When reimplementing events from the ground up in nativescript-html, I found I wasn't able to support listening for events in the constructor, so I just ignored the created events, and things still worked fine. Also found no trace of it elsewhere in the monorepo.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1