mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
1d45367aa1
* Fixed duplication kve bug * Added semistandard and updated code * Actually got it working * Even better * I think it should work on Windows now
26 lines
523 B
JavaScript
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];
|
|
}
|