Basic Configuration of the Node.js® Interface
WinccoaManager Interface in JavaScript
For accessing WinCC OA functionality in TypeScript or JavaScript an instance
of the WinccoaManager
class must be created. This is done by using
import
(TypeScript) or
require
(JavaScript)
In case additional classes should be used, they must be stated within the
import
/require
Block, see example below.
TypeScript - import
WinccoaManager
class
// import WinCC OA interface
import { WinccoaManager } from 'winccoa-manager';
const winccoa = new WinccoaManager();
JavaScript - require
WinccoaManager
class
// require WinCC OA interface
const { WinccoaManager } = require('winccoa-manager');
const winccoa = new WinccoaManager();
TypeScript - import
multiple classes
import { WinccoaManager, WinccoaSecurityEventId, WinccoaError } from 'winccoa-manager';
const winccoa = new WinccoaManager();
Syntax Manager Options
The WinCC OA JavaScript Manager for Node.js allows additional parameters to be passed to Node.js® as well as TypeScript/JavaScript by assigning them to the manager parameters.
These must follow a defined order to be transmitted to the corresponding components:
[Node.js® Command-line Options] [WinCC OA Manager Parameters] <Script Name> [JavaScript Parameters]
- Node.js®-Command line Options
- Command line options, which are directly forwarded to Node.js®, see also Supported Node.js® Command line Options.
Node.js® parameters must be stated with double dashes "
--
". - WinCC OA Manager Parameters
- General WinCC OA manager parameters, see General options.
- Script Name
-
The path/name of the TypeScript/JavaScript script which should be executed by the manager.
The path for the script must be relative to the
nodejs
directory of the project or an absolute path to the script file. - TypeScript/JavaScript Parameters
-
To pass parameters to the script for TypeScript/JavaScript, these must be added at the end after the script name.
Access to the parameters is done via the
process.argv
constant.
--inspect -num 42 mymodule/index.js arg1 arg2
The WinCC OA JavaScript Manager for Node.js will be started in the Debugging Modus with the Node.js® option --inspect
.
The WinCC OA managers starts with manager ID "42" and the
parameters arg1
and arg2
are passed to the started
script mymodule/index.js
.