message: localStorage-based memory in cardstack-tools service
diff: @@ -4,7 +4,31 @@ export default Ember.Service.extend({
  available: true,
  active: false,
  activePanel: 'cardstack-toolbox',
  +
  + init() {
  + this._super();
  + let priorState;
  + try {
  + let item = localStorage.getItem('cardstack-tools');
  + if (item) {
  + priorState = JSON.parse(item);
  + for (let key in priorState) {
  + this.set(key, priorState[key]);
  + }
  + }
  + } catch (err) {
  + // Ignored
  + }
  + this.persistentState = priorState || {};
  + },
  +
  + _updatePersistent(key, value) {
  + this.persistentState[key] = value;
  + localStorage.setItem('cardstack-tools', JSON.stringify(this.persistentState));
  + this.set(key, value);
  + },
  +
  setActive(isActive) {
  - this.set('active', isActive);
  + this._updatePersistent('active', isActive);
  }
  });
  