From a09c19c5018d1d111edce61d72f0109c538b67e8 Mon Sep 17 00:00:00 2001 From: serapath Date: Tue, 10 Apr 2018 18:40:56 +0100 Subject: [PATCH] refactor debugger tab --- src/app/tabs/debugger-tab.js | 42 +++++++++++++++++----- src/app/tabs/styles/debugger-tab-styles.js | 15 -------- 2 files changed, 33 insertions(+), 24 deletions(-) delete mode 100644 src/app/tabs/styles/debugger-tab-styles.js diff --git a/src/app/tabs/debugger-tab.js b/src/app/tabs/debugger-tab.js index 63ebb64e11..d9670f067a 100644 --- a/src/app/tabs/debugger-tab.js +++ b/src/app/tabs/debugger-tab.js @@ -1,12 +1,36 @@ var yo = require('yo-yo') -var css = require('./styles/debugger-tab-styles') +var csjs = require('csjs-inject') +var remixLib = require('remix-lib') -function debuggerTab (api = {}, events = {}, opts = {}) { - var el = yo` -
-
-
` - return { render () { return el } } -} +var EventManager = remixLib.EventManager +var styles = require('../../ui/styles-guide/theme-chooser').chooser() -module.exports = debuggerTab +module.exports = class DebuggerTab { + constructor (opts = { api: {}, events: {} }) { + const self = this + self.event = new EventManager() + self._api = opts.api + self._events = opts.events + self._view = { el: null } + self.data = {} + self._components = {} + } + render () { + const self = this + if (self._view.el) return self._view.el + self._view.el = yo` +
+
+
` + return self._view.el + } +} +const css = csjs` + .debuggerTabView { + padding: 2%; + } + .debugger { + margin-bottom: 1%; + ${styles.rightPanel.debuggerTab.box_Debugger} + } +` diff --git a/src/app/tabs/styles/debugger-tab-styles.js b/src/app/tabs/styles/debugger-tab-styles.js deleted file mode 100644 index ee0d804e17..0000000000 --- a/src/app/tabs/styles/debugger-tab-styles.js +++ /dev/null @@ -1,15 +0,0 @@ -var csjs = require('csjs-inject') -var styleGuide = require('../../ui/styles-guide/theme-chooser') -var styles = styleGuide.chooser() - -var css = csjs` - .debuggerTabView { - padding: 2%; - } - .debugger { - margin-bottom: 1%; - ${styles.rightPanel.debuggerTab.box_Debugger} - } -` - -module.exports = css