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

feat(effectScope): add onDispose method #10826

Open
wants to merge 1 commit into
base: minor
Choose a base branch
from

Conversation

Alfred-Skyblue
Copy link
Member

When the effectScope is not active, we can only listen to its dispose in the following way:

const scope = effectScope();

scope.run(() => {});

scope.cleanups.push(() => {
  /* code */
});

Although this method solves the current problem, it is rather cumbersome. In this PR, I have added an onDispose method, allowing us to listen to the dispose of effectScope in the following manner:

const scope = effectScope();

scope.run(() => {});

scope.onDispose(() => {
  /* code */
});

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 94 kB (+3.27 kB) 35.5 kB (+979 B) 31.9 kB (+859 B)
vue.global.prod.js 151 kB (+3.27 kB) 54.8 kB (+1.01 kB) 49 kB (+878 B)

Usages

Name Size Gzip Brotli
createApp 53.9 kB (+3.19 kB) 20.9 kB (+1.02 kB) 18.9 kB (+843 B)
createSSRApp 57.3 kB (+3.19 kB) 22.2 kB (+997 B) 20.1 kB (+833 B)
defineCustomElement 56.2 kB (+3.19 kB) 21.6 kB (+1.01 kB) 19.6 kB (+807 B)
overall 67.7 kB (+3.25 kB) 25.9 kB (+974 B) 23.4 kB (+812 B)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants