chore(runtime): Add some JSDocs (#81)

This commit is contained in:
Eric Tuvesson
2024-11-18 17:01:49 +01:00
committed by GitHub
parent e25155556f
commit 14786b2144
4 changed files with 105 additions and 72 deletions

View File

@@ -40,8 +40,8 @@ const ClosePopupNode = {
this._internal.closeCallback = cb;
},
scheduleClose: function () {
var _this = this;
var internal = this._internal;
const _this = this;
const internal = this._internal;
if (!internal.hasScheduledClose) {
internal.hasScheduledClose = true;
this.scheduleAfterInputsHaveUpdated(function () {
@@ -113,9 +113,8 @@ module.exports = {
var closeActions = node.parameters['closeActions'];
if (closeActions) {
closeActions = closeActions ? closeActions.split(',') : undefined;
for (var i in closeActions) {
var p = closeActions[i];
for (const i in closeActions) {
const p = closeActions[i];
ports.push({
type: 'signal',
plug: 'input',

View File

@@ -10,8 +10,7 @@ const SetVariableNodeDefinition = {
usePortAsLabel: 'name',
color: 'data',
initialize: function () {
var internal = this._internal;
const internal = this._internal;
internal.variablesModel = Model.get('--ndl--global-variables');
},
getInspectInfo() {
@@ -79,17 +78,22 @@ const SetVariableNodeDefinition = {
if (this.hasScheduledStore) return;
this.hasScheduledStore = true;
var internal = this._internal;
const internal = this._internal;
this.scheduleAfterInputsHaveUpdated(function () {
this.hasScheduledStore = false;
var value = internal.setWith === 'emptyString' ? '' : internal.value;
let value = internal.setWith === 'emptyString' ? '' : internal.value;
// Can set arrays with "id" or array
if (internal.setWith === 'object' && typeof value === 'string') value = Model.get(value);
// Can set arrays with "id" or array
if (internal.setWith === 'array' && typeof value === 'string') value = Collection.get(value);
if (internal.setWith === 'object' && typeof value === 'string') value = Model.get(value); // Can set arrays with "id" or array
if (internal.setWith === 'array' && typeof value === 'string') value = Collection.get(value); // Can set arrays with "id" or array
if (internal.setWith === 'boolean') value = !!value;
//use forceChange to always trigger Variable nodes to send the value on their output, even if it's the same value twice
// use forceChange to always trigger Variable nodes to send the value on
// their output, even if it's the same value twice
internal.variablesModel.set(internal.name, value, {
forceChange: true
});
@@ -101,10 +105,11 @@ const SetVariableNodeDefinition = {
return;
}
if (name === 'value')
if (name === 'value') {
this.registerInput(name, {
set: this.setValue.bind(this)
});
}
}
}
};