From ad4c265d90a017bfda899a4eee17598abf6405fc Mon Sep 17 00:00:00 2001 From: serapath Date: Wed, 6 Jun 2018 06:27:03 -0400 Subject: [PATCH] rhp: refactor to prepare for class --- src/app/panels/righthand-panel.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/app/panels/righthand-panel.js b/src/app/panels/righthand-panel.js index d0fd444b80..8b7ccb0619 100644 --- a/src/app/panels/righthand-panel.js +++ b/src/app/panels/righthand-panel.js @@ -17,7 +17,7 @@ const RunTab = require('../tabs/run-tab') const EventManager = remixLib.EventManager const styles = styleguide.chooser() -module.exports = function RighthandPanel (api = {}, events = {}, opts = {}) { +function RighthandPanel (api = {}, events = {}, opts = {}) { const self = this self._api = api self._events = events @@ -80,11 +80,16 @@ module.exports = function RighthandPanel (api = {}, events = {}, opts = {}) { this._view.tabbedMenu.addTab(json.title, 'plugin', content) self.pluginManager.register(json, content) }) - - self.render = function () { return self._view.element } - - self.init = function () { - ;[...options.children].forEach((el) => { el.classList.add(css.options) }) +} +var prototype = { + constructor: RighthandPanel, + render: function () { + const self = this + return self._view.element + }, + init: function () { + const self = this + // ;[...options.children].forEach((el) => { el.classList.add(css.options) }) // ----------------- resizeable ui --------------- const limit = 60 @@ -127,6 +132,9 @@ module.exports = function RighthandPanel (api = {}, events = {}, opts = {}) { } } } +prototype.constructor.prototype = prototype + +module.exports = prototype.constructor const css = csjs` #righthand-panel {