load indicator module
This commit is contained in:
parent
cbe68047f5
commit
75b3d0adc9
6 changed files with 95 additions and 34 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue