移除事件监听
@param string $type 事件类型
@param string $plugin 监听器
242
public function removeEventListener($type, $plugin) {
		$type = strtolower($type);
		if (isset($this->eventsListeners[$type]) && in_array($plugin, $this->eventsListeners[$type])) {
			$index = array_search($plugin, $this->eventsListeners[$type]);
			array_splice($this->eventsListeners[$type], $index, 1);
		}
	}
866733
public function validatePlugin($plugin)
    {
        if($plugin instanceof AdapterInterface) {
            return;
        }

        throw new InvalidPluginException(sprintf(
            'Plugin of type %s is invalid; must implement %s\AdapterInterface and set ID',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            __NAMESPACE__
        ));
    }
1215958
public function bindPluginEvents(Event $event)
    {
        foreach ($this->plugins as $field => $plugin) {
            $plugin = self::findPluginInstance($field, $plugin, $event->sender->tableName());
            foreach ($plugin->events() as $on => $handler) {
                $event->sender->on($on, is_string($handler) ? [$plugin, $handler] : $handler);
            }
        }
    }
227660
@Override
    public void onPluginEvent(PluginEvent event) {
        switch (event.getAction()) {
            case SUBSCRIBE: // Upon initial subscription, begin listening for specified generic events.
                plugin = event.getPlugin();
                doSubscribe(true);
                break;
            
            case LOAD: // Stop listening once loaded.
                plugin.unregisterListener(this);
                break;
            
            case UNSUBSCRIBE: // Stop listening for generic events once unsubscribed from plugin events.
                doSubscribe(false);
                break;
        }
    }
381977
private void firePluginStopped(final Plugin plugin) {
        PluginEvent e = null;
        synchronized (listenerList) {
            for (Iterator iter = listenerList.iterator(); iter.hasNext();) {
                PluginListener l = (PluginListener) iter.next();
                if (e == null) {
                    e = new PluginEvent(plugin);
                }
                l.pluginStopped(e);
            }
        }
    }
94972
public function registerPlugin($plugin)
    {
        /** @var AnaloguePluginInterface $plugin */
        $plugin = new $plugin($this);

        $this->events = array_merge($this->events, $plugin->getCustomEvents());

        $plugin->register();
    }
40665
public function add($type, $listener)
    {
        if (!array_key_exists($type, $this->_eventListeners)) {
            $this->_eventListeners [$type] = [];
        }
        array_push($this->_eventListeners[$type], $listener);
    }
578748
function (name, type) {
                logger.debug("Attempting to remove plugin: " + name);
                var index, plug, plugs = this.config.plugins;
                for (index = 0; index < plugs.length; index += 1) {
                    plug = plugs[index];
                    if (plug.name === name && plug.type === type) {
                        plugs.splice(index, 1);
                        logger.debug("Plugin: " + name + " has been removed");
                        break;
                    }
                }
            }
212211
public function validatePlugin($plugin)
    {
        if ($plugin instanceof AbstractPlugin) {
            return; // we're okay
        }

        throw new \InvalidArgumentException(sprintf(
            'Can\'t create jQuery plugin for %s; Plugin must be an instance of %s',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            AbstractPlugin::class
        ));
    }
171413
function (plugin) {
    var that = this;

    /**
     * DOM element used for updating the status of requests and list counts.
     * @type {jQuery}
     */
    this.$status = $(plugin.options.templates.status).hide().appendTo(plugin.selectpicker.$menu);
    var statusInitialized = plugin.t('statusInitialized');
    if (statusInitialized && statusInitialized.length) {
        this.setStatus(statusInitialized);
    }

    /**
     * Container for cached data.
     * @type {Object}
     */
    this.cache = {};

    /**
     * Reference the plugin for internal use.
     * @type {AjaxBootstrapSelect}
     */
    this.plugin = plugin;

    /**
     * Container for current selections.
     * @type {Array}
     */
    this.selected = [];

    /**
     * Containers for previous titles.
     */
    this.title = null;
    this.selectedTextFormat = plugin.selectpicker.options.selectedTextFormat;

    // Save initial options
    var initial_options = [];
    plugin.$element.find('option').each(function() {
        var $option = $(this);
        var value = $option.attr('value');
        initial_options.push({
            value: value,
            text: $option.text(),
            'class': $option.attr('class') || '',
            data: $option.data() || {},
            preserved: plugin.options.preserveSelected,
            selected: !!$option.attr('selected')
        });
    });
    this.cacheSet(/*query=*/'', initial_options);

    // Preserve selected options.
    if (plugin.options.preserveSelected) {
        that.selected = initial_options;
        plugin.$element.on('change.abs.preserveSelected', function (e) {
            var $selected = plugin.$element.find(':selected');
            that.selected = [];
            // If select does not have multiple selection, ensure that only the
            // last selected option is preserved.
            if (!plugin.selectpicker.multiple) {
                $selected = $selected.last();
            }
            $selected.each(function () {
                var $option = $(this);
                var value = $option.attr('value');
                that.selected.push({
                    value: value,
                    text: $option.text(),
                    'class': $option.attr('class') || '',
                    data: $option.data() || {},
                    preserved: true,
                    selected: true
                });
            });
            that.replaceOptions(that.cacheGet(that.plugin.query));
        });
    }
}
983567
@Override
    public void onPluginEvent(PluginEvent event) {
        ElementPlugin plugin = event.getPlugin();
        
        switch (event.getAction()) {
            case SUBSCRIBE:
                init();
                plugins.add(plugin);
                plugin.setDisabled(isDisabled());
                break;
            
            case UNSUBSCRIBE:
                plugins.remove(plugin);
                plugin.setDisabled(false);
                break;
        }
    }
1350342
public function isLoaded($plugin)
    {
        $pluginClass = get_class($this->getBundle($plugin));

        foreach ($this->loadedBundles as $bundle => $isEnabled) {
            if ($bundle === $pluginClass && $isEnabled) {
                return true;
            }
        }

        return false;
    }
139147
public function validatePlugin($plugin)
    {
        if ($plugin instanceof AbstractHelper) {
            // we're okay
            return;
        }

        throw new Exception\InvalidArgumentException(sprintf(
            'Plugin of type %s is invalid; must implement %s\AbstractHelper',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            __NAMESPACE__
        ));
    }
780711
def register_plugin(type, klass)
      type = type.to_s
      @plugins[type] ||= []
      @plugins[type].push(klass) unless @plugins[type].include?(klass)
    end
64533
function(event) {
  if (event) {
    var executeDispatch = EventPluginUtils.executeDispatch;
    // Plugins can provide custom behavior when dispatching events.
    var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
    if (PluginModule && PluginModule.executeDispatch) {
      executeDispatch = PluginModule.executeDispatch;
    }
    EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);

    if (!event.isPersistent()) {
      event.constructor.release(event);
    }
  }
}
1188318
public function addPlugin(ServerPlugin $plugin)
    {
        $this->plugins[$plugin->getPluginName()] = $plugin;
        $plugin->initialize($this);
    }
892457
public function addPlugin(PluginInterface $plugin)
    {
        if ($this->io->isDebug()) {
            $this->io->writeError('Loading plugin '.get_class($plugin));
        }
        $this->plugins[] =  $plugin;
        $plugin->activate($this->composer, $this->io);

        if ($plugin instanceof EventSubscriberInterface) {
            $this->composer->getEventDispatcher()->addSubscriber($plugin);
        }
    }