Initial commit
This commit is contained in:
78
Backend/dist/Integrations/buildin/zoomosc/template/basic.js
vendored
Normal file
78
Backend/dist/Integrations/buildin/zoomosc/template/basic.js
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
exports.__esModule = true;
|
||||
exports.ZoomOSC_Basic = void 0;
|
||||
var node_osc_1 = require("node-osc");
|
||||
exports.ZoomOSC_Basic = {
|
||||
handleAction: function (oscAction) {
|
||||
return function (ActionAPI) {
|
||||
ActionAPI.onExecute(function (properties, status, deck) {
|
||||
return exports.ZoomOSC_Basic.onExecute(ActionAPI, oscAction, properties, status, deck);
|
||||
});
|
||||
ActionAPI.onOpenEditor(exports.ZoomOSC_Basic.onOpenEditor);
|
||||
};
|
||||
},
|
||||
onExecute: function (ActionAPI, oscAction, properties, status, deck) {
|
||||
if (properties.connectionID != undefined && properties.connectionID.length > 0) {
|
||||
var connection = ActionAPI.getConnection('zoomosc', properties.connectionID);
|
||||
if (connection) {
|
||||
var ip = connection.properties.ip;
|
||||
var port = connection.properties.port;
|
||||
var header = connection.properties.header;
|
||||
var client = new node_osc_1.Client(ip, port);
|
||||
client.send("/" + header + "/" + properties.target + "/" + oscAction, properties.targetValue, function () {
|
||||
status("OSC Action " + oscAction + " has been called with " + properties.targetValue, 'info');
|
||||
client.close();
|
||||
});
|
||||
}
|
||||
else
|
||||
status('Connection does not exist', 'error');
|
||||
}
|
||||
else
|
||||
status('No connectionID specified', 'error');
|
||||
},
|
||||
onOpenEditor: function (EditorAPI, properties) {
|
||||
var connectionID = properties.connectionID != undefined ? properties.connectionID : 'none';
|
||||
var target = properties.target != undefined ? properties.target : 'userName';
|
||||
var targetValue = properties.targetValue != undefined ? properties.targetValue : '';
|
||||
var connectionField = {
|
||||
id: 'connectionID',
|
||||
name: 'Connection',
|
||||
type: 'connection',
|
||||
connectionType: 'zoomosc',
|
||||
value: connectionID
|
||||
};
|
||||
var targetField = {
|
||||
id: 'target',
|
||||
name: 'Target',
|
||||
type: 'select',
|
||||
value: target,
|
||||
values: [
|
||||
{ id: 'userName', text: 'By username' },
|
||||
{ id: 'targetID', text: 'By target id' },
|
||||
{ id: 'zoomID', text: 'By Zoom id' },
|
||||
{ id: 'galIndex', text: 'By gallery index' },
|
||||
{ id: 'me', text: 'Me' },
|
||||
{ id: 'all', text: 'All' }
|
||||
]
|
||||
};
|
||||
var targetValueField = {
|
||||
id: 'targetValue',
|
||||
name: 'Value',
|
||||
type: 'text',
|
||||
value: targetValue
|
||||
};
|
||||
EditorAPI.onFieldChanges(function (fields) {
|
||||
var fieldObject = EditorAPI.tools.objectifyFieldsValues(fields);
|
||||
EditorAPI.saveProperties({
|
||||
connectionID: fieldObject.connectionID,
|
||||
target: fieldObject.target,
|
||||
targetValue: fieldObject.targetValue
|
||||
});
|
||||
});
|
||||
EditorAPI.setFields([
|
||||
connectionField,
|
||||
targetField,
|
||||
targetValueField
|
||||
]);
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=basic.js.map
|
||||
Reference in New Issue
Block a user