Ember Cached Decorator Polyfill

Polyfill for RFC 566: @cached
Alternatives To Ember Cached Decorator Polyfill
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Uri.js6,14350,6951,016a year ago28April 03, 202262mitJavaScript
Javascript URL mutation library
Better Dateinput Polyfill259522 years ago29April 17, 20218mitJavaScript
input[type=date] polyfill for better-dom
Ember Cached Decorator Polyfill19
8 months ago12mitTypeScript
Polyfill for RFC 566: @cached
Ember In Element Polyfill17
a year ago15mitJavaScript
Polyfill for `in-element` as per RFC 287
Url16
4 months ago2mpl-2.0PHP
Makes the algorithms and APIs defined by URL Standard (replaces RFC 3986 and RFC 3987) available on PHP. / URL Standard (RFC 3986、RFC 3987 を置き換える Web 標準仕様) で定義されているアルゴリズム、および API を PHP から利用できるようにします。
Yay Enums7
7 years agomitPHP
Enumerated Types polyfill for PHP
Web Monetization Polyfill6
4 years agoJavaScript
Polyfill for web monetization that requires no extension
Ember Destroyable Polyfill5
2 years ago17mitJavaScript
Polyfill for RFC 580: Destroyables
Rfc Encode Uri2
7 years agoiscJavaScript
RFC3986 Compliant encodeURI/encodeURIComponent polyfill for Node.js
Babel Plugin Ember Data Packages Polyfill2
3 years agomitJavaScript
Polyfill for EmberData Package Imports (RFC 395)
Alternatives To Ember Cached Decorator Polyfill
Select To Compare


Alternative Project Comparisons
Readme

ember-cached-decorator-polyfill

CI npm version Download Total Ember Observer Score code style: prettier Dependabot enabled dependencies Status devDependencies Status

Polyfill for RFC 566 "@cached decorator".

Installation

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.

Compatibility

  • Ember.js v3.13 or above
  • Ember CLI v2.13 or above
  • Node.js v14 or above

Summary

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 Usage

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.

Explicit Babel Config

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"
  ]
}
Popular Rfc Projects
Popular Polyfill Projects
Popular Collaboration Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Typescript
Types
Emberjs
Ember
Decorators
Rfc
Polyfill
Ember Addon
Memoization