protected function registerEventHandlers(array $config)
    {
        foreach ($config as $name => $depends) {

            // If event is enabled
            $eventName = 'eventOn' . ucfirst($name);
            if (!empty($this->$eventName)) {

                // Make sure dependencies are met
                if (!$this->checkEnabledExtensions($depends)) {
                    throw new InvalidConfigException(
                        "The \"{$name}\" event requires " . implode(', ', $depends) . " extensions to be enabled."
                    );
                }

                // Register event
                $this->view->registerJs(
                    "{$this->id}_ias.on('{$name}', {$this->$eventName});",
                    View::POS_READY,
                    "{$this->id}_ias_event_{$eventName}"
                );
            }
        }
    }