load indicator module

This commit is contained in:
Bala Clark 2015-07-14 10:14:57 +02:00
parent cbe68047f5
commit 75b3d0adc9
6 changed files with 95 additions and 34 deletions

View file

@ -1,7 +1,29 @@
'use strict'
let EventEmitter = require('events').EventEmitter
let $ = require('jquery')
let template = require('./template/load-indicator.handlebars')
module.exports = function loadIndicator () {
console.log(template())
class LoadIndicator extends EventEmitter {
constructor () {
super()
this.render().hide()
}
render () {
this.$el = $(template())
this.el = this.$el.get(0)
return this
}
show () {
this.$el.show()
this.emit('show', this)
}
hide () {
this.$el.hide()
this.emit('hide', this)
}
}
module.exports = LoadIndicator