The main API class is WinccoaManager, start your exploration there.
IMPORTANT
Most code examples in this documentation are not complete, but only snippets that show how to use a method or type. Note that the methods described in this documentation must be called from code inside a method or function to prevent unexpected or undefined behavior.
NOTE
If a code example does not contain an
import
statement, it is assumed that an instance of WinccoaManager has been created and can be accessed with the constantwinccoa
, e. g.:import { WinccoaManager } from 'winccoa-manager';
const winccoa = new WinccoaManager();
NOTE
Almost all examples in this API documentation are given in TypeScript, but it is easy to convert them to JavaScript, if required:
- Replace
import { ... } from 'winccoa-manager'
withconst { ... } = require('winccoa-manager')
.- Remove all explicit type definitions (e. g. replace
name: number
withname
).- Remove all type conversions that are using the keyword
as
.- Do not use the question mark for optional parameters.
Examples given both in TypeScript and JavaScript that illustrate all these points can be found In the documentation for WinccoaDpConnectCallback, WinccoaError and WinccoaAlertTime.
require() or import?
Using
require()
in JavaScript code allows the JavaScript Manager to find modules also when they are located in sub-projects or the WinCC OA installation. This includes the Node.js AddOn that implements this API. Therefore it is strongly recommended to userequire()
in JavaScript code.This is also the reason why TypeScript
ìmport
statements will be transpiled torequire()
when using the templates provided by WinCC OA.