stbWindowMgr
object provides API to the window manager functionality.
Some methods require windowId
field which can be achieved either from stbWindowMgr.windowInit
or from stbWebWindow.windowId
.
Create new window with specified attributes:
var windowId = stbWindowMgr.windowInit(JSON.stringify({
url: 'http://domain.com/some.page.html',
x: 20,
y: 20,
width: 640,
height: 480,
visible: true,
backgroundColor: '#000'
}));
Redefine any of window attributes:
stbWindowMgr.windowAttr(windowId, JSON.stringify({
backgroundColor: '#fff'
}));
Get attributes for the given window:
console.log(stbWindowMgr.windowInfo(windowId));
Change windows visibility:
// make window visible with one of these methods
stbWindowMgr.windowShow(windowId);
stbWindowMgr.windowAttr(windowId, JSON.stringify({visible: true}));
// make window invisible with one of these methods
stbWindowMgr.windowHide(windowId);
stbWindowMgr.windowAttr(windowId, JSON.stringify({visible: false}));
Close given window:
if ( !stbWindowMgr.windowClose(windowId) ) {
console.log('Given window closing is failed!');
}
Also window can be closed from itself:
stbWebWindow.close();
Load new web document into given window:
if ( !stbWindowMgr.windowLoad(windowId, url) ) {
console.log('Failed to execute!');
}
Retrieve IDs of currently existing windows:
console.log('IDs of currently existing windows:', stbWindowMgr.windowList());
Get ID of currently active window:
console.log('ID of currently active window:', stbWindowMgr.windowActive());
It's possible to work with user input on a web pages.
Get information for currently focused UI inputs:
console.log('information for currently focused UI inputs:', stbWindowMgr.GetFocusedInputInfo());
Set text for currently focused HTML element:
stbWindowMgr.SetFocusedInputText('foo');
Different windows can easily interact with each other via messages.
Receive a message from a window:
stbEvent.onMessage = function ( windowId, message, data ) {
console.log('sender ID: ' + windowId);
console.log('message text: ' + message);
console.log('received data: ' + data);
};
Send a message with some data to a window with ID 3:
stbWebWindow.messageSend(3, 'Hello!', JSON.stringify({foo: 1000}));