@serenity-js/core
Version:
The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure
36 lines • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActorSpotlighted = void 0;
const tiny_types_1 = require("tiny-types");
const index_js_1 = require("../../model/index.js");
const index_js_2 = require("../../screenplay/index.js");
const DomainEvent_js_1 = require("../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
*/
class ActorSpotlighted extends DomainEvent_js_1.DomainEvent {
sceneId;
actor;
static fromJSON(o) {
return new ActorSpotlighted(index_js_1.CorrelationId.fromJSON(o.sceneId), o.actor, index_js_2.Timestamp.fromJSON(o.timestamp));
}
constructor(sceneId, actor, timestamp) {
super(timestamp);
this.sceneId = sceneId;
this.actor = actor;
(0, tiny_types_1.ensure)('sceneId', sceneId, (0, tiny_types_1.isDefined)());
(0, tiny_types_1.ensure)('actor', actor, (0, tiny_types_1.isDefined)());
}
}
exports.ActorSpotlighted = ActorSpotlighted;
//# sourceMappingURL=ActorSpotlighted.js.map