Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

angular2-locker

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-locker - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

@@ -81,3 +81,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

this.setNamespace(driverNamespace);
this.setDriver(defaultDriverType);
this.driver = defaultDriverType;
}

@@ -93,6 +93,8 @@

}, {
key: 'setDriver',
value: function setDriver(driver) {
this.driver = driver;
if (!this.driver.isSupported()) this.driver = DRIVERS.MEMORY;
key: 'useDriver',
value: function useDriver(driver) {
return new Locker({
defaultDriverType: driver.isSupported() ? driver : DRIVERS.MEMORY,
driverNamespace: this.namespace
});
}

@@ -99,0 +101,0 @@ }, {

@@ -53,3 +53,3 @@ export interface IStorage {

setNamespace(namespace?: string): void
setDriver(driver: Driver): void
useDriver(driver: Driver): Locker
set(key: any, data: any, expiry?: any): void

@@ -56,0 +56,0 @@ get(key: any): any

{
"name": "angular2-locker",
"version": "0.1.4",
"version": "0.1.5",
"description": "angular2 library for managing session and locker storage, has backup for inmemory if neither are supported",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -49,5 +49,10 @@ angular2-locker

####`setDriver`
`locker.setDriver(Locker.DRIVERS.LOCAL) // for more info on drivers look for static methods`
####`useDriver`
```javascript
// for more info on drivers look for static methods
var driver = locker.useDriver(Locker.DRIVERS.LOCAL)
driver.set('keey', 'value')
```
####`remove`

@@ -54,0 +59,0 @@ `locker.remove('key')`

@@ -1,2 +0,2 @@

declare var sessionStorage, localStorage
declare const sessionStorage, localStorage

@@ -22,3 +22,3 @@ import {Driver} from './Driver'

this.setNamespace(driverNamespace)
this.setDriver(defaultDriverType)
this.driver = defaultDriverType
}

@@ -30,7 +30,7 @@

public setDriver(driver: Driver) {
this.driver = driver
if (!this.driver.isSupported())
this.driver = DRIVERS.MEMORY
public useDriver(driver: Driver) {
return new Locker({
defaultDriverType: driver.isSupported() ? driver : DRIVERS.MEMORY,
driverNamespace: this.namespace
})
}

@@ -37,0 +37,0 @@

@@ -11,4 +11,6 @@ {

"node_modules",
"typings/browser.d.ts",
"typings/browser/",
"test"
]
}