Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
angular-web-storage
Advanced tools
Readme
Angular decorator to save and restore of HTML5 Local&Session Storage
install angular-web-storage
from npm
npm install angular-web-storage --save
LocalStorage
or SessionStorage
decorator.import { Component } from '@angular/core';
import { LocalStorageService, SessionStorageService, LocalStorage, SessionStorage } from 'angular-web-storage';
@Component({
selector: 'demo',
templateUrl: './demo.component.html'
})
export class DemoComponent {
@LocalStorage() localValue: Object = { text: `Hello ${+new Date}`};
// 设置存储KEY,以及10个小时后过期
@LocalStorage('newKey', 10, 'h') localValue2: Object = { text: `Hello ${+new Date}`};
@SessionStorage() sessionValue: string = `Hello ${+new Date}`;
}
LocalStorageService
or SessionStorageService
service.import { Component } from '@angular/core';
import { LocalStorageService, SessionStorageService, LocalStorage, SessionStorage } from 'angular-web-storage';
@Component({
selector: 'demo',
templateUrl: './demo.component.html'
})
export class DemoComponent {
constructor(private local: LocalStorageService, private session: SessionStorageService) { }
KEY = 'value';
value: any = null;
set(expired: number = 0) {
this.local.set(this.KEY, { a: 1, now: +new Date }, expired, 's');
}
remove() {
this.local.remove(this.KEY);
}
get() {
this.value = this.local.get(this.KEY);
}
clear() {
this.local.clear();
}
}
s
Second.m
Minute.h
Hour.d
Day.w
Week(equar 7 Day).y
Year.t
Custom(unit: millisecond).Please follow this guidelines when reporting bugs and feature requests:
Thanks for understanding!
The MIT License (see the LICENSE file for the full text)
FAQs
Angular decorator to save and restore of HTML5 Local&Session Storage
The npm package angular-web-storage receives a total of 3,081 weekly downloads. As such, angular-web-storage popularity was classified as popular.
We found that angular-web-storage demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.