forked from bitfocus/companion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstance_skel.d.ts
143 lines (122 loc) · 3.87 KB
/
instance_skel.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import {
CompanionActions,
CompanionInputField,
CompanionFeedbacks,
CompanionPreset,
CompanionSystem,
CompanionVariable,
CompanionActionEvent,
CompanionFeedbackEvent,
CompanionFeedbackResult,
CompanionUpgradeScript,
CompanionActionEventInfo,
CompanionFeedbackEventInfo,
} from './instance_skel_types'
declare abstract class InstanceSkel<TConfig> {
protected system: CompanionSystem
public id: string
public config: TConfig
/**
* Create an instance of the module.
* @since 1.0.0
*/
constructor(system: CompanionSystem, id: string, config: TConfig)
/**
* Main initialization function called once the module
* is OK to start doing things.
* @since 1.0.0
*/
abstract init(): void
/**
* Clean up the instance before it is destroyed.
* @since 1.0.0
*/
abstract destroy(): void
/**
* Process an updated configuration array.
* @since 1.0.0
*/
abstract updateConfig(config: TConfig): void
/**
* Creates the configuration fields for web config.
* @since 1.0.0
*/
abstract config_fields(): CompanionInputField[]
/**
* Executes the provided action.
* @since 1.0.0
*/
action?(action: CompanionActionEvent, info: CompanionActionEventInfo): void
/**
* Processes a feedback state.
* @since 1.0.0
*/
feedback?(feedback: CompanionFeedbackEvent, info: CompanionFeedbackEventInfo): CompanionFeedbackResult
/**
* Save the current config of the module. Call this if you change any properties on this.config, so that they get persisted
*/
saveConfig(): void
addUpgradeScript(fcn: CompanionUpgradeScript<TConfig>): void
setActions(actions: CompanionActions): void
setVariableDefinitions(variables: CompanionVariable[]): void
setFeedbackDefinitions(feedbacks: CompanionFeedbacks): void
setPresetDefinitions(presets: CompanionPreset[]): void
setVariable(variableId: string, value: string): void
getVariable(variableId: string, cb: (value: string) => void): void
checkFeedbacks(feedbackId?: string): void
/**
* Parse a string to replace any variable references with their values.
* This will parse variables from any module instance, and expects the same syntax as the ui
*/
parseVariables(text: string, cb: (value: string | undefined) => void): void
/**
* Get an array of all the feedbacks for this instance
*/
getAllFeedbacks(): CompanionFeedbackEvent[]
/**
* Trigger the subscribe callback on all feedbacks for this instance
* @param feedbackId Feedback type to call for, or undefined for all
*/
subscribeFeedbacks(feedbackId?: string): void
/**
* Trigger the unsubscribe callback on all feedbacks for this instance
* @param feedbackId Feedback type to call for, or undefined for all
*/
unsubscribeFeedbacks(feedbackId?: string): void
/**
* Get an array of all the actions and release_actions for this instance
*/
getAllActions(): CompanionActionEvent[]
/**
* Trigger the subscribe callback on all actions and release_actions for this instance
* @param actionId Action type to call for, or undefined for all
*/
subscribeActions(actionId?: string): void
/**
* Trigger the unsubscribe callback on all actions and release_actions for this instance
* @param actionId Action type to call for, or undefined for all
*/
unsubscribeActions(actionId?: string): void
status(level: null | 0 | 1 | 2, message?: string): void
log(level: 'info' | 'warn' | 'error' | 'debug', info: string): void
debug(formatter: string, ...args: any[]): void
rgb(red: number, green: number, blue: number): number
rgbRev(color: number): { r: number; g: number; b: number }
STATUS_UNKNOWN: null
STATUS_OK: 0
STATUS_WARNING: 1
STATUS_ERROR: 2
REGEX_IP: string
REGEX_BOOLEAN: string
REGEX_PORT: string
REGEX_PERCENT: string
REGEX_FLOAT: string
REGEX_FLOAT_OR_INT: string
REGEX_SIGNED_FLOAT: string
REGEX_NUMBER: string
REGEX_SOMETHING: string
REGEX_SIGNED_NUMBER: string
REGEX_TIMECODE: string
CHOICES_YESNO_BOOLEAN: any
}
export = InstanceSkel