core/plugin.js
function addPlugin(plugin) {
  if (!plugin) {
    return;
  }
  if (!needFilterPlugin) {
    console.warn('You are adding a plugin after getPlugins is called.');
  }
  needFilterPlugin = true;
  if (!plugin.name) {
    console.log('plugin: ', plugin);
    throw new Error('Each plugin should have a name.');
  }
  if (_.find(allPlugins, { name: plugin.name })) {
    console.warn('You should not add a plugin with same name: ' + plugin.name);
    return;
  }
  allPlugins.push(plugin);
}
function addPlugin(plugin) {
  if (!plugin) {
    return;
  }
  if (!needFilterPlugin) {
    console.warn('You are adding a plugin after getPlugins is called.');
  }
  needFilterPlugin = true;
  if (!plugin.name) {
    console.log('plugin: ', plugin);
    throw new Error('Each plugin should have a name.');
  }
  if (_.find(allPlugins, { name: plugin.name })) {
    console.warn('You should not add a plugin with same name: ' + plugin.name);
    return;
  }
  allPlugins.push(plugin);
}
function addPlugin ( plugin ) { if ( ! plugin ) { return ; } if ( ! needFilterPlugin ) { console . warn ( 'You are adding a plugin after getPlugins is called.' ) ; } needFilterPlugin = true ; if ( ! plugin . name ) { console . log ( 'plugin: ' , plugin ) ; throw new Error ( 'Each plugin should have a name.' ) ; } if ( _ . find ( allPlugins , { name : plugin . name } ) ) { console . warn ( 'You should not add a plugin with same name: ' + plugin . name ) ; return ; } allPlugins . push ( plugin ) ; }
Dynamically add an plugin
Dynamically add an plugin