insomnia/app/ui/components/modals/index.js
Gregory Schier 1d45367aa1 Added eslint and fixed all problems (#101)
* Fixed duplication kve bug

* Added semistandard and updated code

* Actually got it working

* Even better

* I think it should work on Windows now
2017-03-03 12:09:08 -08:00

26 lines
523 B
JavaScript

const modals = {};
export function registerModal (instance) {
if (instance === null) {
// Modal was unmounted
return;
}
modals[instance.constructor.name] = instance;
}
export function showModal (modalCls, ...args) {
return _getModal(modalCls).show(...args);
}
export function toggleModal (modalCls, ...args) {
return _getModal(modalCls).toggle(...args);
}
export function hideModal (modalCls) {
return _getModal(modalCls).hide();
}
function _getModal (modalCls) {
return modals[modalCls.name];
}