From ab90aa8bfd7019735219edcc6268f5ea3a4bcf3a Mon Sep 17 00:00:00 2001 From: serapath Date: Thu, 7 Jun 2018 09:27:18 -0400 Subject: [PATCH] testTab: refactor to class --- src/app/tabs/test-tab.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 4f940e0901..c94d0b25a2 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -3,13 +3,8 @@ var async = require('async') var css = require('./styles/test-tab-styles') var remixTests = require('remix-tests') -function append (container, txt) { - let child = yo`
${txt}
` - container.appendChild(child) -} - -const prototype = { - constructor: function testTab (api = {}, events = {}, opts = {}) { +module.exports = class TestTab { + constructor (api = {}, events = {}, opts = {}) { const self = this self._opts = opts self._api = api @@ -18,21 +13,26 @@ const prototype = { self._components = {} self.data = {} - self._view.el = prototype.render() + self._view.el = self.render() events.app.register('tabChanged', tabName => { if (tabName !== 'test') return - yo.update(self._view.el, prototype.render()) + yo.update(self._view.el, self.render()) self._view.el.style.display = 'block' }) return { render () { return self._view.el } } - }, - render: function render () { + } + render () { const self = this const api = self._api var container = yo`
` + function append (container, txt) { + let child = yo`
${txt}
` + container.appendChild(child) + } + let testCallback = function (result) { if (result.type === 'contract') { append(container, '\n ' + result.value) @@ -109,5 +109,3 @@ const prototype = { return el } } -prototype.constructor.prototype = prototype -module.exports = prototype.constructor