insomnia/app/ui/components/modals/index.js
Gregory Schier e380a4d2b1 Insomnia Plus Launch (#41)
* Payment modal done

* Refactor settings and added command support

* Made sync operations more efficient

* Sync button slightly more efficient

* Remove Elm

* Fixed Codemirror

* Nunjucks 3.0

* Revert sourcemap change and some renaming

* Some fixes for Config creation, and added name to resources

* Set to new Insomnia URL

* Some fixes
2016-11-07 12:24:38 -08:00

26 lines
522 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];
}