-
Notifications
You must be signed in to change notification settings - Fork 109
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
Conversation
增加了资源引用计数的能力,将Image接入了,其他插件也需要接入资源的引用计数。 |
class ResourceItem implements ResourceStruct { | ||
name: string; | ||
type: RESOURCE_TYPE; | ||
src: { |
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.
这里的定义,可能会导致类型提示都失效了
}; | ||
complete?: boolean; | ||
preload?: boolean; | ||
data?: { |
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.
这里的定义,可能会导致类型提示都失效了
this.loadResource({ names: [name] }); | ||
return this.promiseMap[name] || Promise.resolve({}); | ||
if (this.promiseMap[name]) { | ||
this.resourcesMap[name]?.ref() |
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.
getResource方法能确保一定是在用到资源的时候被调用吗?
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.
对Resource的引用判断用计数的方案仍然纯在疑惑,且只改造了Image,暂时不合并这个PR
Please check if the PR fulfills these requirements
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: