
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
ember-cached-decorator-polyfill
Advanced tools
Polyfill for RFC 566 "@cached decorator".
ember install ember-cached-decorator-polyfill
For addons, pass the -S
flag.
If you're working in an environment with an explicit Babel config (like a V2
addon or an app with ember-cli-babel
's { useBabelConfig: true }
mode), see "Explicit Babel Config" below.
Add a @cached
decorator for memoizing the result of a getter based on
autotracking. In the following example, fullName
would only recalculate if
firstName
or lastName
is updated.
import { tracked, cached } from '@glimmer/tracking';
class Person {
@tracked firstName = 'Jen';
@tracked lastName = 'Weber';
@cached
get fullName() {
return `${this.firstName} ${this.lastName}`;
}
}
For detailed usage instructions, refer to the RFC 566 "@cached decorator".
TypeScript's normal type resolution for an import from @glimmer/tracking
will not find the types provided by this polyfill, since the actual
@glimmer/tracking
package does not include an export for cache
.
In order for TypeScript to recognize the extra cache
export, add an import
like this somewhere in your codebase (like app.ts
or test-helper.ts
):
import 'ember-cached-decorator-polyfill';
Once the upstream types have been updated to reflect RFC 566, this will no longer be necessary.
In environments where you have an explicit Babel config (like authoring a V2
addon) you will need to configure this polyfill's babel plugin. Add it to your
babel.config.js
like:
{
"plugins": [
"ember-cached-decorator-polyfill/babel-plugin"
]
}
v1.0.2 (2023-07-26)
FAQs
Polyfill for RFC 566: @cached
The npm package ember-cached-decorator-polyfill receives a total of 12,993 weekly downloads. As such, ember-cached-decorator-polyfill popularity was classified as popular.
We found that ember-cached-decorator-polyfill demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.