$
This commit is contained in:
17
node_modules/riot/esm/api/install.js
generated
vendored
Normal file
17
node_modules/riot/esm/api/install.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/* 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 };
|
Reference in New Issue
Block a user