Skip to content

Commit

Permalink
testTab: refactor prepare class
Browse files Browse the repository at this point in the history
  • Loading branch information
serapath committed Jun 7, 2018
1 parent 00a9480 commit 2e79287
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/app/tabs/test-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function append (container, txt) {
container.appendChild(child)
}

function testTabView (api) {
function render (api) {
var container = yo`<div class="tests" id="tests"></div>`

let testCallback = function (result) {
Expand Down Expand Up @@ -87,20 +87,25 @@ function testTabView (api) {
}

function testTab (api = {}, events = {}, opts = {}) {
let el = testTabView(api)
let el = render(api)
let gitterIsLoaded = false

events.app.register('tabChanged', (tabName) => {
if (tabName !== 'test' || gitterIsLoaded) {
return
}

yo.update(el, testTabView(api))
yo.update(el, render(api))
el.style.display = 'block'
gitterIsLoaded = true
})

return { render () { return el } }
}

module.exports = testTab
const prototype = {
constructor: testTab,
render: render
}
prototype.constructor.prototype = prototype
module.exports = prototype.constructor

0 comments on commit 2e79287

Please sign in to comment.