本文整理汇总了TypeScript中og-components/og-lru-cache-factory/models/og-lru-cache-factory.new函数的典型用法代码示例。如果您正苦于以下问题:TypeScript new函数的具体用法?TypeScript new怎么用?TypeScript new使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了new函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach((): void => {
// Populate the data with capacity + 1 items (to check that the oldest item is evicted)
data = [...Array(capacity + 1).keys()].reverse().map((id: number): OgCacheEntry => ({id, name: `item ${id}`}));
list = data.slice(0, capacity);
// Create the LruCache
ogLruCache = ogLruCacheFactory.new(capacity, data);
});
示例2: constructor
public constructor(private readonly $http: angular.IHttpService, $cacheFactory: angular.ICacheFactoryService,
private readonly $window: angular.IWindowService, ogLruCacheFactory: OgLruCacheFactory) {
this.cache = $cacheFactory("payees");
// Create an LRU cache and populate with the recent payee list from local storage
this.lruCache = ogLruCacheFactory.new(LRU_CAPACITY, JSON.parse(this.$window.localStorage.getItem(this.LRU_LOCAL_STORAGE_KEY) || "[]") as OgCacheEntry[]);
this.recent = this.lruCache.list;
}
示例3: it
it("should return an LruCache", (): Chai.Assertion => ogLruCacheFactory.new(10, []).should.be.an("object"));