Skip to content
Snippets Groups Projects
Commit 1526da72 authored by Philipp Sautner's avatar Philipp Sautner
Browse files

Revert "Merge branch '720-LocalStorage-Share-Sautner' into 'staging'"

This reverts merge request !726
parent 7a526d8f
No related merge requests found
......@@ -6,21 +6,21 @@ import { Injectable } from '@angular/core';
export class LocalStorageShareService {
constructor() {
window.addEventListener('message', this.messageHandler.bind(this), false);
window.addEventListener('message', this.messageHandler, false);
}
messageHandler(event) {
const { action, key, value} = JSON.parse(event.data);
const { action, key, value} = event.data;
if (action === 'save') {
window.localStorage.setItem(key, JSON.stringify(value));
} else if (action === 'get') {
const obj = JSON.parse(window.localStorage.getItem(key));
if(obj !== null) {
event.source.postMessage(JSON.stringify({
event.source.postMessage({
action: 'returnData',
key,
obj
}), '*');
}, '*');
}
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment