parcoursup/node_modules/riot/esm/api/install.js
lalBi94 7bc56c09b5 $
2023-03-05 13:23:23 +01:00

18 lines
519 B
JavaScript

/* Riot WIP, @license MIT */
import { isFunction, panic, PLUGINS_SET } from '@riotjs/util';
/**
* Define a riot plugin
* @param {Function} plugin - function that will receive all the components created
* @returns {Set} the set containing all the plugins installed
*/
function install(plugin) {
if (!isFunction(plugin)) panic('Plugins must be of type function');
if (PLUGINS_SET.has(plugin)) panic('This plugin was already installed');
PLUGINS_SET.add(plugin);
return PLUGINS_SET;
}
export { install };