From 5a9807e851a85e4aa8aa9a6bc1c567d18592e69f Mon Sep 17 00:00:00 2001 From: Christian Alfoni Date: Sun, 10 Apr 2016 22:04:09 +0200 Subject: [PATCH 1/2] feat(multiApp): support handling multiple apps BREAKING CHANGE: Needs latest version of the debugger, 0.43 or higher --- index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index f4442e8..e079120 100644 --- a/index.js +++ b/index.js @@ -30,7 +30,7 @@ module.exports = function Devtools () { var disableDebugger = false var willKeepState = false var APP_ID = String(Date.now()) - var VERSION = 'v2' + var VERSION = 'v3' var isAwaitingFrame = false var nextSignalInLine = 0 @@ -194,7 +194,15 @@ module.exports = function Devtools () { } window.addEventListener('cerebral.dev.debuggerPing', function () { - initialize() + var event = new CustomEvent('cerebral.dev.cerebralPong', { + detail: JSON.stringify({ + type: 'init', + app: APP_ID, + version: VERSION, + data: getInit() + }) + }) + window.dispatchEvent(event) }) window.addEventListener('cerebral.dev.toggleKeepState', function () { From 38b28e0490f8a6c4f6933d5a5ce02a9873e2d3c1 Mon Sep 17 00:00:00 2001 From: Christian Alfoni Date: Sun, 10 Apr 2016 23:39:30 +0200 Subject: [PATCH 2/2] feat(debugger): support new version of debugger BREAKING CHANGE: need latest version of debugger, 0.43 --- index.js | 48 ------------------------------------------------ package.json | 2 +- 2 files changed, 1 insertion(+), 49 deletions(-) diff --git a/index.js b/index.js index e079120..a97cf9d 100644 --- a/index.js +++ b/index.js @@ -117,10 +117,6 @@ module.exports = function Devtools () { } } - var updateInit = function () { - update('init', getInit()) - } - var updateSignals = function () { if (isAwaitingFrame) { return @@ -149,50 +145,6 @@ module.exports = function Devtools () { }, true) } - var initialize = function () { - if (isInitialized) { - updateInit() - } - var signals = [] - - if (utils.hasLocalStorage()) { - disableDebugger = JSON.parse(localStorage.getItem('cerebral_disable_debugger')) - signals = JSON.parse(localStorage.getItem('cerebral_signals')) || [] - willKeepState = JSON.parse(localStorage.getItem('cerebral_willKeepState')) - } - - isInitialized = true - - // Might be an async signal running here - if (willKeepState && signalStore.isExecutingAsync()) { - controller.once('signalEnd', function () { - signalStore.setSignals(signals) - signalStore.remember(signalStore.getSignals().length - 1) - var event = new CustomEvent('cerebral.dev.cerebralPong', { - detail: JSON.stringify({ - type: 'init', - app: APP_ID, - version: VERSION, - data: getInit() - }) - }) - window.dispatchEvent(event) - }) - } else { - signalStore.setSignals(signals) - signalStore.rememberInitial(signalStore.getSignals().length - 1) - var event = new CustomEvent('cerebral.dev.cerebralPong', { - detail: JSON.stringify({ - type: 'init', - app: APP_ID, - version: VERSION, - data: getInit() - }) - }) - window.dispatchEvent(event) - } - } - window.addEventListener('cerebral.dev.debuggerPing', function () { var event = new CustomEvent('cerebral.dev.cerebralPong', { detail: JSON.stringify({ diff --git a/package.json b/package.json index 1d16e69..80204f8 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "cerebral": "^0.33.8" }, "dependencies": { - "cerebral-module-signal-store": "^0.1.3" + "cerebral-module-signal-store": "^0.1.5" }, "config": { "commitizen": {