I am trying to figure out how to set and retrieve a value in the app-localstorage-document. I worked before with the iron-meta element and did it like so:
<iron-meta id="meta" key="id" value="{{meta}}"></iron-meta>
Polymer({
is: 'login-form',
properties: {
meta: {
type: String,
value: ''
},
},
getValue: function() {
this.meta = '100'
var savedValue = this.$.meta.byKey('id');
console.log(savedValue);
}
});
But when I try something similar with the app-localstorage-document it just returns:
Promise {[[PromiseStatus]]: "resolved", [[PromiseValue]]: undefined}
I cant find any example on how to work with this element. Maybe someone can help me out here.
<app-localstorage-document id="meta" key="id" data="{{meta}}" storage="window.localStorage"></app-localstorage-document>
Polymer({
is: 'login-form',
properties: {
meta: {
type: String,
value: ''
},
},
getValue: function() {
this.$.meta.setStoredValue('id', '50');
var savedValue = this.$.meta.getStoredValue('id');
console.log(savedValue);
}
});