PillowPillow / ng2-webstorage

Localstorage and sessionstorage manager - Angular service
MIT License
428 stars 92 forks source link

Functions are gone after page refresh #104

Closed d35h closed 5 years ago

d35h commented 5 years ago

Hi,

I'm not sure if it's a bug for sure, but this one is definitely not a feature, this is why I went for the 'Bug report' :)

Versions (please complete the following information):

Describe the bug My concern is that when I try to store functions to either localStorage or sessionStorage after the page refresh (F5), the functions are gone, however, properties are still persisted

To Reproduce Steps to reproduce the behavior: Before the page refresh: this.foo = (a) => {console.log(a)} (a) => {console.log(a)}

this.localStorageService.store('obj', {'foo': this.foo, 'property': 'propertyValue'}); {foo: ƒ, property: "propertyValue"}

this.localStorageService.retrieve('obj').property "propertyValue"

this.localStorageService.retrieve('obj').foo (a) => {console.log(a)}

After the page refresh: this.localStorageService.retrieve('obj').foo undefined

this.localStorageService.retrieve('obj').property "propertyValue"

Expected behavior I would expect that saved function would be still in a storage

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Cheers, Dani

d35h commented 5 years ago

Consider this one as closed, I did my research and it doesn't look like the issue of this library