-
Notifications
You must be signed in to change notification settings - Fork 27
How to use WITs as APIs
setWitsconfigInfo() is for setting WITs environment, It should be called before start function or watch function.
// async
void setWitsconfigInfo(WitsInfoData data)
dictionary WitsInfoData {
DOMString? width;
DOMString deviceIp;
DOMString hostIp;
DOMString baseAppPath;
boolean isDebugMode;
DOMString profilePath;
}const wits = require('@tizentv/wits');
const data = {
deviceIp: '123.123.123.123',
hostIp: '456.456.456.456',
isDebugMode: true,
baseAppPath: 'e:/dev/tizenworkspace/export', //The application path which you want to live-reload.
profilePath: 'e:/dev/Wits/resource/profiles.xml' //Profile path for packaging your application.
};
await wits.setWitsconfigInfo(data);start() is a sequence for building and installing your application, connecting PC and Target TV, pushing files, supporting live-reload feature.
// async
void start()const wits = require('@tizentv/wits');
const data = {
deviceIp: '123.123.123.123',
hostIp: '456.456.456.456',
isDebugMode: true,
baseAppPath: 'e:/dev/tizenworkspace/export', //The application path which you want to live-reload.
profilePath: 'e:/dev/Wits/resource/profiles.xml' //Profile path for packaging your application.
};
await wits.setWitsconfigInfo(data);
await wits.start();watch() is a sequence for connecting PC and Target TV, pushing files, supporting live-reload feature. (Except for re-building and re-installing your application.)
// async
void watch()const wits = require('@tizentv/wits');
const data = {
deviceIp: '123.123.123.123',
hostIp: '456.456.456.456',
isDebugMode: true,
baseAppPath: 'e:/dev/tizenworkspace/export', //The application path which you want to live-reload.
profilePath: 'e:/dev/Wits/resource/profiles.xml' //Profile path for packaging your application.
};
await wits.setWitsconfigInfo(data);
await wits.watch();disconnect() is for disconnecting communications between PC and Target TV.
// async
void disconnect()const wits = require('@tizentv/wits');
await wits.disconnect();setOutputChannel() is for getting WITs' log information. The return value is integer value between 1000 and 9999, and this value will be used to unsetOutputChannel(). You can integrate the WITs' log on your application.
int setOutputChannel(OutputCallback callback)
interface OutputCallback {
void online();
};// integrate to VS Code output
const wits = require('@tizentv/wits');
const vscode = require('vscode');
const output = vscode.window.createOutputChannel('WITs output');
const id = wits.setOutputChannel(output.appendLine);unsetOutputChannel() is for unregistering the output callback. Call the unsetOutputChannel() with the return value of the setOutputChannel().
void unsetOutputChannel(long requestId)const wits = require('@tizentv/wits');
wits.unsetOutputChannel(id);