remove jquery dep, use native dom api instead
This commit is contained in:
parent
155edf4935
commit
f63ac2e286
5 changed files with 6 additions and 16 deletions
|
@ -1,6 +1,4 @@
|
||||||
let EventEmitter = require('events').EventEmitter
|
let EventEmitter = require('events').EventEmitter
|
||||||
let $ = require('jquery')
|
|
||||||
let template = require('./template/load-indicator.handlebars')
|
|
||||||
|
|
||||||
class LoadIndicator extends EventEmitter {
|
class LoadIndicator extends EventEmitter {
|
||||||
constructor () {
|
constructor () {
|
||||||
|
@ -9,18 +7,18 @@ class LoadIndicator extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
this.$el = $(template())
|
this.el = document.createElement('div')
|
||||||
this.el = this.$el.get(0)
|
this.el.id = 'cb-loading-overlay'
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
show () {
|
show () {
|
||||||
this.$el.show()
|
this.el.style.display = 'block'
|
||||||
this.emit('show', this)
|
this.emit('show', this)
|
||||||
}
|
}
|
||||||
|
|
||||||
hide () {
|
hide () {
|
||||||
this.$el.hide()
|
this.el.style.display = 'none'
|
||||||
this.emit('hide', this)
|
this.emit('hide', this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
<div id="cb-loading-overlay" class="cb-control"></div>
|
|
5
npm-shrinkwrap.json
generated
5
npm-shrinkwrap.json
generated
|
@ -1317,11 +1317,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jquery": {
|
|
||||||
"version": "2.1.4",
|
|
||||||
"from": "jquery@>=2.0.0 <3.0.0",
|
|
||||||
"resolved": "http://registry.npmjs.org/jquery/-/jquery-2.1.4.tgz"
|
|
||||||
},
|
|
||||||
"js-tokens": {
|
"js-tokens": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"from": "js-tokens@1.0.1",
|
"from": "js-tokens@1.0.1",
|
||||||
|
|
|
@ -59,7 +59,5 @@
|
||||||
"uglify-js": "^2.4.23",
|
"uglify-js": "^2.4.23",
|
||||||
"watchify": "http://registry.npmjs.org/watchify/-/watchify-3.2.3.tgz"
|
"watchify": "http://registry.npmjs.org/watchify/-/watchify-3.2.3.tgz"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {}
|
||||||
"jquery": "^2.1.4"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe('LoadIndicator', function () {
|
||||||
it('should render on init', function () {
|
it('should render on init', function () {
|
||||||
let indicator = new LoadIndicator()
|
let indicator = new LoadIndicator()
|
||||||
assert.equal(indicator.el.outerHTML
|
assert.equal(indicator.el.outerHTML
|
||||||
, '<div id="cb-loading-overlay" class="cb-control" style="display: none; "></div>')
|
, '<div id="cb-loading-overlay" style="display: none; "></div>')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should show', function () {
|
it('should show', function () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue