Skip to content
Snippets Groups Projects
Select Git revision
  • d019b02f388527f3030e45aa6780b656d09b3acc
  • master default
  • renovate/assertj-core.version
  • renovate/major-fontawesome.version
  • renovate/datatables.version
  • renovate/opencsv.version
  • renovate/org.springframework.boot-spring-boot-starter-parent-3.x
  • renovate/junit-jupiter-engine.version
  • renovate/selenium.version
  • renovate/testcontainer.version
  • demo
  • v1_8_1
  • v2.18.1
  • v2.18.0
  • v2.17.2
  • v2.17.1
  • v2.17.0
  • v2.16.1
  • v2.16.0
  • v2.15.1
  • v2.15.0
  • v2.14.0
  • v2.13.0
  • v2.12.0
  • v2.11.0
  • v2.10.0
  • v2.9.2
  • v2.9.1
  • v2.9.0
  • v2.8.0
  • testPipeline2
  • v2.7.0
32 results

base_en.properties

Blame
  • main.js 5.04 KiB
    const {InstanceBase, Regex, runEntrypoint, InstanceStatus} = require('@companion-module/base')
    const UpgradeScripts = require('./upgrades')
    const UpdateActions = require('./actions')
    const UpdateFeedbacks = require('./feedbacks')
    const UpdateVariableDefinitions = require('./variables')
    const WebSocket = require('ws')
    const ProjectUpdate = require("./receive/project_update");
    const Project = require("./project");
    const PadNameUpdate = require("./receive/pad_name_update");
    const uuid = require('uuid');
    
    class ModuleInstance extends InstanceBase {
        isInitialized = false
        // language=RegExp
        wsRegex = '^wss?:\\/\\/([\\da-z\\.-]+)(:\\d{1,5})?(?:\\/(.*))?$'
    
        messageHandlers = {
            'project-current': new ProjectUpdate(),
            'pad-name-changed': new PadNameUpdate()
        };
    
        currentProject = new Project({});
    
        constructor(internal) {
            super(internal)
        }
    
        async init(config) {
            this.config = config
    
            this.initWebSocket()
            this.isInitialized = true
    
            this.updateActions() // export actions
            this.updateFeedbacks() // export feedbacks
            this.updateVariableDefinitions() // export variable definitions
        }
    
        // When module gets deleted
        async destroy() {
            this.isInitialized = false
    
            if (this.ws) {
                this.ws.close(1000)
                delete this.ws
            }
        }
    
        async configUpdated(config) {
            this.config = config
            this.initWebSocket()
        }
    
        // Return config fields for web config
        getConfigFields() {
            return [
                {
                    type: 'textinput',
                    id: 'host',
                    label: 'PlayWall IP',
                    width: 8,
                    regex: Regex.IP,
                },
                {
                    type: 'textinput',
                    id: 'port',
                    label: 'PlayWall Port',
                    width: 4,
                    regex: Regex.PORT,
                },