Skip to content

Instantly share code, notes, and snippets.

View artall64's full-sized avatar

Artem Vorobev artall64

  • Cyprus, Limassol
View GitHub Profile
@artall64
artall64 / localStorage.ts
Created September 15, 2020 16:03
LocalStorage decorator for typescript
export function LocalStorage (name: string) {
const key = name;
return function (target: Object, propName: string) {
Object.defineProperty(
target,
propName, {
get () {
let item = localStorage.getItem(key);