当前位置: 首页 > 软件库 > 程序开发 > >

ember-cached-decorator-polyfill

Polyfill for RFC 566: @cached
授权协议 MIT License
开发语言 JavaScript
所属分类 程序开发
软件类型 开源软件
地区 不详
投 递 者 阙繁
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

ember-cached-decorator-polyfill

CI

Polyfill for RFC 566 "@cached decorator".

Installation

ember install ember-cached-decorator-polyfill

For addons, pass the -S flag.

Compatibility

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

Summary

Add a @cached decorator for memoizing the result of a getter based onautotracking. In the following example, fullName would only recalculate iffirstName 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 theRFC 566 "@cached decorator".

TypeScript Usage

TypeScript's normal type resolution for an import from @glimmer/trackingwill not find the types provided by this package (since TypeScriptwould attempt to resolve it as node_modules/@glimmer/tracking or underthe Definitely Typed location for @glimmer/tracking).

Once the addition to the @glimmer/tracking API is a documented part of Ember'sAPI, the types will be available upstream, but in the meantime users will needto modify their tsconfig.json to tell TypeScript where these types are.

Add the following to your tsconfig.json:

{
  // ...snip...
  "paths": {
    // ...snip...
    "@glimmer/tracking": [
      "node_modules/ember-cached-decorator-polyfill",
      "node_modules/@glimmer/tracking/dist/types"
    ],
  }
}
 相关资料
  • Simple-cached-manage(SCM) 提供一个简单的方法为 Spring 的 Bean 启用可交互缓存支持,使用时只需要在 Bean 中通过 @Annotation 注释进行声明即可。现阶段支持mencached、redis、ehcache的缓存切换。 文档将在后续持续更新~

  • In some cases, it can be handy to cache images as they’re downloaded from the web so they can be used offline. For this purpose, you’ll employ the cached_network_image package. In addition to caching,

  • android-async-http (android-async-http-cached)是基于 Android Asynchronous HTTP Library (https://github.com/loopj/android-async-http)  实现。 1.增加响应数据本地缓存功能。 2.便于JSON-RPC,XML-RPC方式调用。   用法: public class Test

  • 装饰器模式允许用户在不改变其结构的情况下向现有对象添加新功能。 这种类型的设计模式属于结构模式,因为此模式充当现有类的包装器。 此模式创建一个装饰器类,它包装原始类并提供其他功能,使类方法签名保持不变。 装饰器模式的动机是动态附加对象的附加职责。 如何实现装饰设计模式 下面提到的代码是如何在Python中实现装饰器设计模式的简单演示。 插图包括以课堂形式演示咖啡店。 创建的咖啡类是抽象的,这意味着

  • serverless-examples-cached-rds-ws A serverless framework example project that uses API Gateway, ElastiCache, and RDS PostgreSQL.

  • Webpage Decorator 这个Chrome浏览器扩展提供了一些可以自定义网页颜色主题和字体的选项。不过安装本扩展后会在Chrome浏览器的地址栏右侧增加一个按钮,也许这会 导致部分网页的地址显示不全。 单击这个按钮就会打开此扩展的选项,可以调整网页背景图片、背景颜色、已读链接的颜色以及网页文字的颜色、字体大小和字体类型等。 颜色选择器是为改变颜色准备的,使用者通过它可选择自己喜欢的颜色或