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: resource resource reference #195

Closed
wants to merge 1 commit into from
Closed

feat: resource resource reference #195

wants to merge 1 commit into from

Conversation

fanmingfei
Copy link
Member

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Other information:

@fanmingfei
Copy link
Member Author

增加了资源引用计数的能力,将Image接入了,其他插件也需要接入资源的引用计数。

class ResourceItem implements ResourceStruct {
name: string;
type: RESOURCE_TYPE;
src: {
Copy link
Member

Choose a reason for hiding this comment

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

这里的定义,可能会导致类型提示都失效了

};
complete?: boolean;
preload?: boolean;
data?: {
Copy link
Member

Choose a reason for hiding this comment

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

这里的定义,可能会导致类型提示都失效了

this.loadResource({ names: [name] });
return this.promiseMap[name] || Promise.resolve({});
if (this.promiseMap[name]) {
this.resourcesMap[name]?.ref()
Copy link
Member

Choose a reason for hiding this comment

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

getResource方法能确保一定是在用到资源的时候被调用吗?

Copy link
Member

@terrykingcha terrykingcha left a comment

Choose a reason for hiding this comment

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

对Resource的引用判断用计数的方案仍然纯在疑惑,且只改造了Image,暂时不合并这个PR

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

Successfully merging this pull request may close these issues.

resource销毁资源,但是资源还在使用的情况下会报错
2 participants