-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: simplify lifecycle implementation #3863
Conversation
callback(this); | ||
} | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also went ahead and DRY'd up this code, although it doesn't turn out to make a perf impact.
@@ -97,6 +98,7 @@ export { | |||
create, | |||
defineProperties, | |||
defineProperty, | |||
entries, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Object.entries
is supported in all our supported browsers; we had just never used it before.
import { | ||
LifecycleCallback, | ||
connectRootElement, | ||
disconnectRootElement, | ||
runFormAssociatedCallback, | ||
runFormDisabledCallback, | ||
runFormResetCallback, | ||
runFormStateRestoreCallback, | ||
} from '@lwc/engine-core'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
Details
I realized we can simplify the implementation by removing
setLifecycleCallbacks
entirely and moving everything insidecreate-custom-element.ts
in@lwc/engine-dom
. It turns out that all the callback functions we need are already exposed by the@lwc/engine-core
package and can be just imported into@lwc/engine-dom
.Tachometer does not report a perf difference between this method and #3862.
Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?