angular-async-cache
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="0.1.1"></a> | ||
## [0.1.1](https://github.com/mattlewis92/angular-async-cache/compare/v0.1.0...v0.1.1) (2016-11-05) | ||
### Bug Fixes | ||
* **aot:** fix aot compilation ([92ac699](https://github.com/mattlewis92/angular-async-cache/commit/92ac699)) | ||
<a name="0.1.0"></a> | ||
@@ -7,0 +17,0 @@ # 0.1.0 (2016-11-05) |
@@ -1,5 +0,9 @@ | ||
import { ModuleWithProviders } from '@angular/core'; | ||
import { ModuleWithProviders, OpaqueToken } from '@angular/core'; | ||
import { AsyncCacheOptionsInterface } from './asyncCacheOptions.provider'; | ||
export declare const ASYNC_CACHE_USER_DEFAULTS: OpaqueToken; | ||
export declare const memoryDriverFactory: Function; | ||
export declare const localStorageDriverFactory: Function; | ||
export declare const cacheOptionDefaultsFactory: Function; | ||
export declare class AsyncCacheModule { | ||
static forRoot(userDefaults?: AsyncCacheOptionsInterface): ModuleWithProviders; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { NgModule, OpaqueToken } from '@angular/core'; | ||
import { LocalStorageDriver } from './drivers/localStorageDriver.provider'; | ||
@@ -7,2 +7,12 @@ import { MemoryDriver } from './drivers/memoryDriver.provider'; | ||
import { AsyncCachePipe } from './asyncCache.pipe'; | ||
export var ASYNC_CACHE_USER_DEFAULTS = new OpaqueToken('ASYNC_CACHE_USER_DEFAULTS'); | ||
export var memoryDriverFactory = function (options) { | ||
return options.driver instanceof MemoryDriver ? options.driver : new MemoryDriver(); | ||
}; | ||
export var localStorageDriverFactory = function (options) { | ||
return options.driver instanceof LocalStorageDriver ? options.driver : new LocalStorageDriver(); | ||
}; | ||
export var cacheOptionDefaultsFactory = function (userDefaults) { | ||
return new AsyncCacheOptions(userDefaults); | ||
}; | ||
export var AsyncCacheModule = (function () { | ||
@@ -12,13 +22,12 @@ function AsyncCacheModule() { | ||
AsyncCacheModule.forRoot = function (userDefaults) { | ||
var defaults = new AsyncCacheOptions(userDefaults); | ||
var localStorage = defaults.driver instanceof LocalStorageDriver ? defaults.driver : new LocalStorageDriver(); | ||
var memory = defaults.driver instanceof MemoryDriver ? defaults.driver : new MemoryDriver(); | ||
return { | ||
ngModule: AsyncCacheModule, | ||
providers: [{ | ||
provide: LocalStorageDriver, useValue: localStorage | ||
provide: LocalStorageDriver, useFactory: localStorageDriverFactory, deps: [AsyncCacheOptions] | ||
}, { | ||
provide: MemoryDriver, useValue: memory | ||
provide: MemoryDriver, useFactory: memoryDriverFactory, deps: [AsyncCacheOptions] | ||
}, { | ||
provide: AsyncCacheOptions, useValue: defaults | ||
provide: ASYNC_CACHE_USER_DEFAULTS, useValue: userDefaults | ||
}, { | ||
provide: AsyncCacheOptions, useFactory: cacheOptionDefaultsFactory, deps: [ASYNC_CACHE_USER_DEFAULTS] | ||
}, AsyncCache] | ||
@@ -25,0 +34,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"AsyncCacheModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./asyncCache.pipe","name":"AsyncCachePipe"}],"exports":[{"__symbolic":"reference","module":"./asyncCache.pipe","name":"AsyncCachePipe"}]}]}]}}} | ||
{"__symbolic":"module","version":1,"metadata":{"ASYNC_CACHE_USER_DEFAULTS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["ASYNC_CACHE_USER_DEFAULTS"]},"memoryDriverFactory":{"__symbolic":"error","message":"Function call not supported","line":9,"character":45},"localStorageDriverFactory":{"__symbolic":"error","message":"Function call not supported","line":13,"character":51},"cacheOptionDefaultsFactory":{"__symbolic":"error","message":"Function call not supported","line":17,"character":52},"AsyncCacheModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./asyncCache.pipe","name":"AsyncCachePipe"}],"exports":[{"__symbolic":"reference","module":"./asyncCache.pipe","name":"AsyncCachePipe"}]}]}],"statics":{"forRoot":{"__symbolic":"function","parameters":["userDefaults"],"value":{"ngModule":{"__symbolic":"reference","name":"AsyncCacheModule"},"providers":[{"provide":{"__symbolic":"reference","module":"./drivers/localStorageDriver.provider","name":"LocalStorageDriver"},"useFactory":{"__symbolic":"reference","name":"localStorageDriverFactory"},"deps":[{"__symbolic":"reference","module":"./asyncCacheOptions.provider","name":"AsyncCacheOptions"}]},{"provide":{"__symbolic":"reference","module":"./drivers/memoryDriver.provider","name":"MemoryDriver"},"useFactory":{"__symbolic":"reference","name":"memoryDriverFactory"},"deps":[{"__symbolic":"reference","module":"./asyncCacheOptions.provider","name":"AsyncCacheOptions"}]},{"provide":{"__symbolic":"reference","name":"ASYNC_CACHE_USER_DEFAULTS"},"useValue":{"__symbolic":"reference","name":"userDefaults"}},{"provide":{"__symbolic":"reference","module":"./asyncCacheOptions.provider","name":"AsyncCacheOptions"},"useFactory":{"__symbolic":"reference","name":"cacheOptionDefaultsFactory"},"deps":[{"__symbolic":"reference","name":"ASYNC_CACHE_USER_DEFAULTS"}]},{"__symbolic":"reference","module":"./asyncCache.provider","name":"AsyncCache"}]}}}}}} |
@@ -90,2 +90,12 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var asyncCache_pipe_1 = __webpack_require__(14); | ||
exports.ASYNC_CACHE_USER_DEFAULTS = new core_1.OpaqueToken('ASYNC_CACHE_USER_DEFAULTS'); | ||
exports.memoryDriverFactory = function (options) { | ||
return options.driver instanceof memoryDriver_provider_1.MemoryDriver ? options.driver : new memoryDriver_provider_1.MemoryDriver(); | ||
}; | ||
exports.localStorageDriverFactory = function (options) { | ||
return options.driver instanceof localStorageDriver_provider_1.LocalStorageDriver ? options.driver : new localStorageDriver_provider_1.LocalStorageDriver(); | ||
}; | ||
exports.cacheOptionDefaultsFactory = function (userDefaults) { | ||
return new asyncCacheOptions_provider_1.AsyncCacheOptions(userDefaults); | ||
}; | ||
var AsyncCacheModule = (function () { | ||
@@ -95,13 +105,12 @@ function AsyncCacheModule() { | ||
AsyncCacheModule.forRoot = function (userDefaults) { | ||
var defaults = new asyncCacheOptions_provider_1.AsyncCacheOptions(userDefaults); | ||
var localStorage = defaults.driver instanceof localStorageDriver_provider_1.LocalStorageDriver ? defaults.driver : new localStorageDriver_provider_1.LocalStorageDriver(); | ||
var memory = defaults.driver instanceof memoryDriver_provider_1.MemoryDriver ? defaults.driver : new memoryDriver_provider_1.MemoryDriver(); | ||
return { | ||
ngModule: AsyncCacheModule, | ||
providers: [{ | ||
provide: localStorageDriver_provider_1.LocalStorageDriver, useValue: localStorage | ||
provide: localStorageDriver_provider_1.LocalStorageDriver, useFactory: exports.localStorageDriverFactory, deps: [asyncCacheOptions_provider_1.AsyncCacheOptions] | ||
}, { | ||
provide: memoryDriver_provider_1.MemoryDriver, useValue: memory | ||
provide: memoryDriver_provider_1.MemoryDriver, useFactory: exports.memoryDriverFactory, deps: [asyncCacheOptions_provider_1.AsyncCacheOptions] | ||
}, { | ||
provide: asyncCacheOptions_provider_1.AsyncCacheOptions, useValue: defaults | ||
provide: exports.ASYNC_CACHE_USER_DEFAULTS, useValue: userDefaults | ||
}, { | ||
provide: asyncCacheOptions_provider_1.AsyncCacheOptions, useFactory: exports.cacheOptionDefaultsFactory, deps: [exports.ASYNC_CACHE_USER_DEFAULTS] | ||
}, asyncCache_provider_1.AsyncCache] | ||
@@ -108,0 +117,0 @@ }; |
{ | ||
"name": "angular-async-cache", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A simple utility to help with caching of promises and observables to enable an easy offline first approach in angular 2.0+ apps", | ||
@@ -5,0 +5,0 @@ "main": "./dist/umd/angular-async-cache.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80461
674