1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-11 10:22:53 +00:00
Files
mywebsite/mongoui/mongoui-master/node_modules/derby-ui-boot/modal/index.js
2015-06-25 16:28:41 -05:00

24 lines
515 B
JavaScript

exports.create = function(model, dom) {
var self = this;
dom.addListener(document, 'keydown', function(e) {
if (e.keyCode === 27) { // Escape
self.close('escape')
}
})
}
exports.show = function() {
this.model.set('show', true)
}
exports.close = function(action) {
var cancelled = this.emitCancellable('close', action)
if (!cancelled) this.model.set('show', false)
}
exports._click = function(e) {
var action = e.target.getAttribute('data-action')
if (action) this.close(action)
}