Skip to content
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: move disposing properties into the base class #33740

Merged
merged 2 commits into from
May 11, 2021

Conversation

GeoSot
Copy link
Member

@GeoSot GeoSot commented Apr 25, 2021

This Pr :
Moves some more functionality to base-component, transferring some responsibility of disposal, to parent class
Each component, dusting disposal, sets its protected properties to null. So the same can be done in one place for all children components

@GeoSot GeoSot marked this pull request as ready for review April 25, 2021 00:10
@GeoSot GeoSot requested a review from a team as a code owner April 25, 2021 00:10
@@ -31,7 +31,10 @@ class BaseComponent {
dispose() {
Data.remove(this._element, this.constructor.DATA_KEY)
EventHandler.off(this._element, `.${this.constructor.DATA_KEY}`)
this._element = null

for (const propertyName of Object.getOwnPropertyNames(this)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not use for...of yet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to forEach

@XhmikosR XhmikosR changed the title Components.js: super.dispose() can be responsible for its children properties disposal All components: super.dispose() can be responsible for its children properties disposal Apr 25, 2021
@GeoSot GeoSot force-pushed the gs-dispose-can-handle-all-obj-properties branch from a5c1a22 to 58a7eca Compare April 25, 2021 21:35
@GeoSot GeoSot added this to Inbox in v5.0.1 via automation May 5, 2021
@GeoSot GeoSot moved this from Inbox to Approved in v5.0.1 May 5, 2021
@GeoSot GeoSot force-pushed the gs-dispose-can-handle-all-obj-properties branch from 58a7eca to 66e54ab Compare May 10, 2021 22:02
@XhmikosR XhmikosR changed the title All components: super.dispose() can be responsible for its children properties disposal Refactor: move disposing properties into the base class May 11, 2021
@XhmikosR XhmikosR merged commit 03842b5 into main May 11, 2021
v5.0.1 automation moved this from Approved to Done May 11, 2021
@XhmikosR XhmikosR deleted the gs-dispose-can-handle-all-obj-properties branch May 11, 2021 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
v5.0.1
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants