- class GraphicsEngineAssignment {
- constructor(graphicsEngine = null, graphicsEngineOutput = null) {
- this._graphicsEngineName = null;
- this._graphicsEngineFullTypeName = null;
- this._graphicsEnginePlatformName = null;
- this._graphicsEngine = null;
- this._engineId = null;
- this._output = null;
- this._outputId = null;
- this._outputName = null;
- this._language = null;
- this._graphicsEngineUpdatedHandlers = new Set();
- this._outputUpdatedHandlers = new Set();
- this._propertyChangedHandlers = new Set();
- this.UpdateGraphicsEngineAndOutput(graphicsEngine, graphicsEngineOutput);
- }
- SubscribeGraphicsEngineUpdated(handler) {
- this._graphicsEngineUpdatedHandlers.add(handler);
- }
- UnsubscribeGraphicsEngineUpdated(handler) {
- this._graphicsEngineUpdatedHandlers.delete(handler);
- }
- SubscribeOutputUpdated(handler) {
- this._outputUpdatedHandlers.add(handler);
- }
- UnsubscribeOutputUpdated(handler) {
- this._outputUpdatedHandlers.delete(handler);
- }
- _invokeHandlers(handlers) {
- for (const handler of [...handlers]) {
- handler(this, {});
- }
- }
- get OutputName() {
- return this._outputName;
- }
- set OutputName(value) {
- this._outputName = value;
- }
- get GraphicsEngineName() {
- return this._graphicsEngineName;
- }
- set GraphicsEngineName(value) {
- this._graphicsEngineName = value;
- }
- get EngineId() {
- return this._engineId;
- }
- set EngineId(value) {
- this._engineId = value;
- }
- get OutputId() {
- return this._outputId;
- }
- set OutputId(value) {
- this._outputId = value;
- }
- get GraphicsEngineFullTypeName() {
- return this._graphicsEngineFullTypeName;
- }
- set GraphicsEngineFullTypeName(value) {
- this._graphicsEngineFullTypeName = value;
- }
- get GraphicsEnginePlatformName() {
- return this._graphicsEnginePlatformName;
- }
- set GraphicsEnginePlatformName(value) {
- this._graphicsEnginePlatformName = value;
- }
- get Language() {
- return this._language;
- }
- set Language(value) {
- this._language = value;
- }
- get GraphicsEngine() {
- return this._graphicsEngine;
- }
- get Output() {
- return this._output;
- }
- get IsGraphicsEngineMissing() {
- return this.GraphicsEngine == null;
- }
- get IsOutputMissing() {
- return this.Output == null;
- }
- get IsValid() {
- return !this.IsOutputMissing && !this.IsGraphicsEngineMissing;
- }
- UpdateGraphicsEngineAndOutput(graphicsEngine, output) {
- this._updateGraphicsEngine(graphicsEngine);
- this._updateOutput(output);
- }
- _updateOutput(output) {
- if (this.Output === output) {
- return;
- }
- this._output = output;
- if (this.Output != null) {
- this.OutputName = this.Output.Name;
- this.OutputId = this.Output.Id;
- }
- this._invokeHandlers(this._outputUpdatedHandlers);
- }
- _updateGraphicsEngine(graphicsEngine) {
- if (this.GraphicsEngine === graphicsEngine) {
- return;
- }
- this._graphicsEngine = graphicsEngine;
- if (this.GraphicsEngine != null) {
- this.GraphicsEngineName = this.GraphicsEngine.Name;
- this.GraphicsEngineFullTypeName = this.GraphicsEngine.constructor?.fullTypeName ?? this.GraphicsEngine.constructor?.name ?? null;
- this.GraphicsEnginePlatformName = this.GraphicsEngine.PlatformName;
- this.EngineId = this.GraphicsEngine.Id;
- }
- this._invokeHandlers(this._graphicsEngineUpdatedHandlers);
- }
- }
Untitled
From Harmless Terrapin, 3 Weeks ago, written in Plain Text, viewed 9 times.
This paste will join the choir invisible in 2 Days.
URL https://paste.afonso.co/view/fe11bdb2
Embed
Download Paste or View Raw
— Expand Paste to full width of browser