Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Proposal: remove created event #48

rigor789 started this conversation in 1. Ideas & Discussions
Discussion options

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.

https://github.com/NativeScript/NativeScript/blob/8d25d251cd1c311d3f73e526bf2fd4ee0b2be0b8/packages/core/ui/core/view-base/index.ts#L472

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

You must be logged in to vote

Replies: 1 comment

Comment options

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.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /