
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
angular2-locker
Advanced tools
angular2 library for managing session and locker storage, has backup for inmemory if neither are supported
Wrapper around sessionStorage and localStorage for angular2. If both are unavailable will use an in memory storage.
$ npm i --save angular2-locker
import {NgModule} from '@angular/core'
import {LockerModule, Locker, LockerConfig} from 'angular2-locker'
@Component({
selector: 'app',
template: `...`
})
class App {
constructor(locker: Locker) {
locker.set('something', value)
}
}
@NgModule({
providers: [LockerModule],
declarations: [App],
bootstrap: [App]
})
class AppModule {
constructor(private locker: Locker) {}
}
import {LockerModule, LockerConfig, DRIVERS} from 'angular2-locker'
const lockerConfig = new LockerConfig('nameSpace', DRIVERS.MEMORY, '-')
@NgModule({
providers: [LockModule.forRoot(lockerConfig)]
...
})
class SomeModule {
}
####get
locker.get('myKey')
####set
locker.set('myKey', 'value')
locker.set('myKey', {object: 'value'})
####key
locker.set('key', 'value')
locker.key(0) // 'key'
####has
locker.has('key')
####setNamespace
locker.setNamespace('myName')
locker.setNamespace()
- Resets to lockerConfig default
####setSeparator
locker.setSeparator('-')
locker.setSeparator()
- Resets to lockerConfig default
####useDriver
// for more info on drivers look for static methods
var driver = locker.useDriver(Locker.DRIVERS.LOCAL)
driver.set('keey', 'value')
####remove
locker.remove('key')
####clear
locker.clear()
DRIVERS
These are the types of drivers available. If you try to set it to a driver that is unsupported it will fallback to the memory driver
Types are available under Locker.DRIVERS
or import {DRIVERS} from 'angular2-locker'
DRIVERS.SESSION
- Session CacheDRIVERS.LOCAL
- Local StorageDRIVERS.MEMORY
- Memory StorageDRIVERS.COOKIE
- CookiesFAQs
angular2 library for managing session and locker storage, has backup for inmemory if neither are supported
The npm package angular2-locker receives a total of 3 weekly downloads. As such, angular2-locker popularity was classified as not popular.
We found that angular2-locker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.