If there is no Transition from the SourceState with this Event use addCommandAndSelfTransition().

@param $sourceStateName
@param string  $eventName
@param \SplObserver $command
341917
public function addCommand($sourceStateName, $eventName, \SplObserver $command)
    {
        $this->findOrCreateEvent($sourceStateName, $eventName)->attach($command);
    }
884015
function(event_name) {

		this._event_listeners[event_name] = this._createEventWrapper(event_name);

		if ((event_name in this._dom_event_support) && this._dom_event_support[event_name].delegation) {

			Firestorm.Element.addDelegation(window, event_name, '*', this._event_listeners[event_name]);

		} else {

			Firestorm.Element.addListener(window, event_name, this._event_listeners[event_name]);

		}

	}
397812
private function assertNamingConventionSatisfied($commandClassName, $handlerClassName)
    {
        if (!$this->isNamingConventionSatisfied($commandClassName, $handlerClassName)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Command Handler does not follow naming convention. Expected: "%s". "%s" given.',
                    $this->getExpectedHandlerName($commandClassName),
                    ClassUtils::shortName($handlerClassName)
                )
            );
        }
    }
1309746
public static <S extends HasAttachHandlers> void fire(S source, PopupState popupState,
                                                          PopupOptions popupOptions) {
      if (TYPE != null) {
        JQMPopupEvent event = new JQMPopupEvent(popupState);
        if (popupOptions != null) event.setPopupOptions(popupOptions);
        source.fireEvent(event);
      }
    }
1250765
protected function createTransition(TransitionInterface $sourceTransition)
    {
        $targetStateName = $sourceTransition->getTargetState()->getName();
        $targetState = $this->findOrCreateState($targetStateName);
        $this->mergeMetadata($sourceTransition->getTargetState(), $targetState);
        $eventName = $sourceTransition->getEventName();

        $condition = $this->createCondition($sourceTransition);
        
        $transition = new Transition($targetState, $eventName, $condition);
        if ($sourceTransition instanceof WeightedInterface) {
            $transition->setWeight($sourceTransition->getWeight());
        }

        return $transition;
    }
70884
private Observable<R> executeCommandAndObserve(final AbstractCommand<R> _cmd) {
        final HystrixRequestContext currentRequestContext = HystrixRequestContext.getContextForCurrentThread();

        final Action1<R> markEmits = new Action1<R>() {
            @Override
            public void call(R r) {
                if (shouldOutputOnNextEvents()) {
                    executionResult = executionResult.addEvent(HystrixEventType.EMIT);
                    eventNotifier.markEvent(HystrixEventType.EMIT, commandKey);
                }
                if (commandIsScalar()) {
                    long latency = System.currentTimeMillis() - executionResult.getStartTimestamp();
                    eventNotifier.markEvent(HystrixEventType.SUCCESS, commandKey);
                    executionResult = executionResult.addEvent((int) latency, HystrixEventType.SUCCESS);
                    eventNotifier.markCommandExecution(getCommandKey(), properties.executionIsolationStrategy().get(), (int) latency, executionResult.getOrderedList());
                    circuitBreaker.markSuccess();
                }
            }
        };

        final Action0 markOnCompleted = new Action0() {
            @Override
            public void call() {
                if (!commandIsScalar()) {
                    long latency = System.currentTimeMillis() - executionResult.getStartTimestamp();
                    eventNotifier.markEvent(HystrixEventType.SUCCESS, commandKey);
                    executionResult = executionResult.addEvent((int) latency, HystrixEventType.SUCCESS);
                    eventNotifier.markCommandExecution(getCommandKey(), properties.executionIsolationStrategy().get(), (int) latency, executionResult.getOrderedList());
                    circuitBreaker.markSuccess();
                }
            }
        };

        final Func1<Throwable, Observable<R>> handleFallback = new Func1<Throwable, Observable<R>>() {
            @Override
            public Observable<R> call(Throwable t) {
                circuitBreaker.markNonSuccess();
                Exception e = getExceptionFromThrowable(t);
                executionResult = executionResult.setExecutionException(e);
                if (e instanceof RejectedExecutionException) {
                    return handleThreadPoolRejectionViaFallback(e);
                } else if (t instanceof HystrixTimeoutException) {
                    return handleTimeoutViaFallback();
                } else if (t instanceof HystrixBadRequestException) {
                    return handleBadRequestByEmittingError(e);
                } else {
                    /*
                     * Treat HystrixBadRequestException from ExecutionHook like a plain HystrixBadRequestException.
                     */
                    if (e instanceof HystrixBadRequestException) {
                        eventNotifier.markEvent(HystrixEventType.BAD_REQUEST, commandKey);
                        return Observable.error(e);
                    }

                    return handleFailureViaFallback(e);
                }
            }
        };

        final Action1<Notification<? super R>> setRequestContext = new Action1<Notification<? super R>>() {
            @Override
            public void call(Notification<? super R> rNotification) {
                setRequestContextIfNeeded(currentRequestContext);
            }
        };

        Observable<R> execution;
        if (properties.executionTimeoutEnabled().get()) {
            execution = executeCommandWithSpecifiedIsolation(_cmd)
                    .lift(new HystrixObservableTimeoutOperator<R>(_cmd));
        } else {
            execution = executeCommandWithSpecifiedIsolation(_cmd);
        }

        return execution.doOnNext(markEmits)
                .doOnCompleted(markOnCompleted)
                .onErrorResumeNext(handleFallback)
                .doOnEach(setRequestContext);
    }
1189949
protected function dispatchJsonRpcEvent(string $eventName, JsonRpcServerEvent $event = null) : void
    {
        // Do nothing if dispatcher is not there
        if ($this->jsonRpcServerDispatcher) {
            $this->jsonRpcServerDispatcher->dispatchJsonRpcEvent($eventName, $event);
        }
    }
614892
public function trigger($eventName, $target = null)
    {
        $event = $this->createEvent($eventName);
        $event->setTarget($target);
        $this->triggerHandlers($event);
    }
299310
public void registerTransition(Automaton source, Automaton destiny) {
        source.parent = this;
        destiny.parent = this;
        ArrayList<Transition> r = possibleTransitions.get(source);
        if (r == null) {
            r = new ArrayList<Transition>();
        }
        r.add(new Transition(destiny));
        possibleTransitions.put(source, r);
    }
130743
protected function _commandNew($command)
    {
        $name = $this->getController()->getIdentifier()->name;

        $command
        ->append(array('label' => AnTranslator::_('COM-UBSCRIPTIONS-TOOLBAR-'.$name.'-NEW')))
        ->href('#')
        ->setAttribute('data-trigger', 'ReadForm');
    }
483638
public function _eventHandlerPeek($event, $source, $data)
    {
        $context = $this->_context;

        $context->events[] = $event;

        if ($event === 'logger:log') {
            /**
             * @var Log $log
             */
            $log = $data;
            $format = '[%time%][%level%] %message%';
            $replaces = [
                '%time%' => date('H:i:s.', $log->timestamp) . sprintf('%.03d', ($log->timestamp - (int)$log->timestamp) * 1000),
                '%level%' => $log->level,
                '%message%' => $log->message
            ];
            $context->log[] = [
                'level' => $log->level,
                'message' => strtr($format, $replaces)
            ];
        } elseif ($event === 'db:beforeQuery' || $event === 'db:beforeExecute') {
            /**
             * @var \ManaPHP\DbInterface $source
             */
            $preparedSQL = $source->getSQL();
            if (!isset($context->sql_prepared[$preparedSQL])) {
                $context->sql_prepared[$preparedSQL] = 1;
            } else {
                $context->sql_prepared[$preparedSQL]++;
            }

            $context->sql_count++;
            $context->sql_executed[] = [
                'prepared' => $source->getSQL(),
                'bind' => $source->getBind(),
                'emulated' => $source->getEmulatedSQL()
            ];
        } elseif ($event === 'db:afterQuery' || $event === 'db:afterExecute') {
            /**
             * @var \ManaPHP\DbInterface $source
             */
            $context->sql_executed[$context->sql_count - 1]['elapsed'] = $data['elapsed'];
            $context->sql_executed[$context->sql_count - 1]['row_count'] = $source->affectedRows();
        } elseif ($event === 'db:beginTransaction' || $event === 'db:rollbackTransaction' || $event === 'db:commitTransaction') {
            $context->sql_count++;

            $parts = explode(':', $event);
            $name = $parts[1];

            $context->sql_executed[] = [
                'prepared' => $name,
                'bind' => [],
                'emulated' => $name,
                'time' => 0,
                'row_count' => 0
            ];

            $preparedSQL = $name;
            if (!isset($context->_sql_prepared[$preparedSQL])) {
                $context->sql_prepared[$preparedSQL] = 1;
            } else {
                $context->sql_prepared[$preparedSQL]++;
            }
        } elseif ($event === 'renderer:beforeRender') {
            $vars = $data['vars'];
            foreach ((array)$vars as $k => $v) {
                if ($v instanceof Component) {
                    unset($vars[$k]);
                }
            }
            unset($vars['di']);
            $context->view[] = ['file' => $data['file'], 'vars' => $vars, 'base_name' => basename(dirname($data['file'])) . '/' . basename($data['file'])];
        } elseif ($event === 'mongodb:afterQuery') {
            $item = [];
            $item['type'] = 'query';
            $item['raw'] = ['namespace' => $data['namespace'], 'filter' => $data['filter'], 'options' => $data['options']];
            $options = $data['options'];
            list(, $collection) = explode('.', $data['namespace'], 2);
            $shell = "db.$collection.";
            $shell .= (isset($options['limit']) ? 'findOne(' : 'find(') . json_encode($data['filter'], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
            if (isset($options['projection'])) {
                $shell .= ', ' . json_encode($options['projection'], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . ');';
            } else {
                $shell .= ');';
            }

            $item['shell'] = $shell;
            $item['elapsed'] = $data['elapsed'];
            $context->mongodb[] = $item;
        } elseif ($event === 'mongodb:afterCommand') {
            $item = [];
            $item['type'] = 'command';
            $item['raw'] = ['db' => $data['db'], 'command' => $data['command'], 'options' => $data['options']];
            $item['shell'] = [];
            $item['elapsed'] = $data['elapsed'];
            $context->mongodb[] = $item;
        } elseif ($event === 'mongodb:afterBulkWrite') {
            $item = [];
            $item['type'] = 'bulkWrite';
            $item['raw'] = ['db' => $data['db'], 'command' => $data['command'], 'options' => $data['options']];
            $item['shell'] = [];
            $item['elapsed'] = $data['elapsed'];
            $context->mongodb = [];
        }
    }
669704
public function performEvent($eventName, $eventData = null)
    {
        $url = $this->url() . '/command/' . $eventName;
        $response = $this->api->post($url, $eventData);
        $this->data = (array) $response->data;

        return $this;
    }
321977
protected function listenToSubscribable($targetEventName)
    {
        foreach ($this->sourcePatterns as $event) {
            $listener = $this->newSubscribableListener($event, $targetEventName);
            $this->source->on($event, $listener);
        }
        $this->isFixed = true;
    }
537343
function(source, propertyName)
	{
		if (!conbo.isAccessor(source, propertyName) && !conbo.isFunc(source, propertyName))
		{
			if (source instanceof conbo.EventDispatcher)
			{
				conbo.makeBindable(source, [propertyName]);
			}
			else
			{
				conbo.warn('It will not be possible to detect changes to "'+propertyName+'" because "'+source.toString()+'" is not an EventDispatcher');
			}
		}
	}
433466
protected function _triggerEvent($eventName, $entity, $eventArgs)
    {
        if (null === $this->_application) {
            return;
        }

        $dispatcher = $this->_application->getEventDispatcher();
        if (null !== $dispatcher) {
            $dispatcher->triggerEvent($eventName, $entity, $eventArgs);
        }
    }
419570
protected function dispatchEvent($eventName, \Symfony\Component\EventDispatcher\Event $event)
    {
        if (!$event->isPropagationStopped()) {
            $dispatcher = $this->getEventDispatcher();
            $dispatcher->dispatch($eventName, $event);
        }
        return !$event->isPropagationStopped();
    }
822532
def _change_source_state(name, state):
    '''
    

    '''
    choc_path = _find_chocolatey(__context__, __salt__)
    cmd = [choc_path, 'source', state, '--name', name]
    result = __salt__['cmd.run_all'](cmd, python_shell=False)

    if result['retcode'] != 0:
        raise CommandExecutionError(
            'Running chocolatey failed: {0}'.format(result['stdout'])
        )

    return result['stdout']