UNPKG

@mixer/interactive-node

Version:

A NodeJS and Browser compatible client for mixer.com's interactive 2 Protocol

44 lines 1.47 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var controls_1 = require("./controls"); var Scene_1 = require("./Scene"); /** * The StateFactory creates the apropriate instance of a class for a given socket message. */ var StateFactory = /** @class */ (function () { function StateFactory() { } StateFactory.prototype.setClient = function (client) { this.client = client; }; StateFactory.prototype.createControl = function (controlKind, values, scene) { var control; switch (controlKind) { case 'button': control = new controls_1.Button(values); break; case 'joystick': control = new controls_1.Joystick(values); break; case 'label': control = new controls_1.Label(values); break; case 'textbox': control = new controls_1.Textbox(values); break; default: control = new controls_1.Control(values); } control.setClient(this.client); control.setScene(scene); return control; }; StateFactory.prototype.createScene = function (values) { var scene = new Scene_1.Scene(values); scene.setClient(this.client); return scene; }; return StateFactory; }()); exports.StateFactory = StateFactory; //# sourceMappingURL=StateFactory.js.map