UNPKG

streamdeck-typescript

Version:

This library will help you build elgato stream deck plugins in typescript

39 lines 2.31 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); const src_1 = require("../src"); class CounterPi extends src_1.StreamDeckPropertyInspectorHandler { constructor() { super(); } onDocumentReady() { var _a, _b; this.count = document.getElementById('count'); this.count.addEventListener('keyup', () => this.settingsManager.setContextSettingsAttributes(this.actionInfo.context, { count: this.count.valueAsNumber }, 500)); this.stepsCount = document.getElementById('steps'); this.stepsCount.addEventListener('keyup', () => this.settingsManager.setContextSettingsAttributes(this.actionInfo.context, { steps: this.stepsCount.valueAsNumber }, 500)); const settings = this.settingsManager.getContextSettings(this.actionInfo.context); this.count.value = ((_a = settings === null || settings === void 0 ? void 0 : settings.count) !== null && _a !== void 0 ? _a : 0).toString(); this.stepsCount.value = ((_b = settings === null || settings === void 0 ? void 0 : settings.steps) !== null && _b !== void 0 ? _b : 1).toString(); } onSettingsReceived({ payload: { settings } }) { var _a, _b; if (Object.keys(settings).length <= 0) return; this.count.value = (_a = settings.count.toString()) !== null && _a !== void 0 ? _a : 0; this.stepsCount.value = (_b = settings.steps.toString()) !== null && _b !== void 0 ? _b : 1; } } __decorate([ src_1.SDOnPiEvent('documentLoaded') ], CounterPi.prototype, "onDocumentReady", null); __decorate([ src_1.SDOnPiEvent('didReceiveSettings') ], CounterPi.prototype, "onSettingsReceived", null); new CounterPi(); //# sourceMappingURL=counter-pi.js.map