UNPKG

@serenity-js/core

Version:

The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure

32 lines 1.29 kB
import { ensure, isDefined } from 'tiny-types'; import { CorrelationId } from '../../model/index.js'; import { Timestamp } from '../../screenplay/index.js'; import { DomainEvent } from '../DomainEvent.js'; /** * Emitted when an [`Actor`](https://serenity-js.org/api/core/class/Actor/) becomes * the active actor (moves into the spotlight) as the result of invoking * [`actorCalled`](https://serenity-js.org/api/core/function/actorCalled/). * * This event is emitted only when the spotlight shifts to a different actor. * Consecutive retrievals of the same actor do not emit additional events. * * To detect when an actor is instantiated for the first time, listen for * [`ActorEntersStage`](https://serenity-js.org/api/core-events/class/ActorEntersStage/). * * @group Events */ export class ActorSpotlighted extends DomainEvent { sceneId; actor; static fromJSON(o) { return new ActorSpotlighted(CorrelationId.fromJSON(o.sceneId), o.actor, Timestamp.fromJSON(o.timestamp)); } constructor(sceneId, actor, timestamp) { super(timestamp); this.sceneId = sceneId; this.actor = actor; ensure('sceneId', sceneId, isDefined()); ensure('actor', actor, isDefined()); } } //# sourceMappingURL=ActorSpotlighted.js.map