Name | Description |
---|---|
getId | Returns window unique identifier |
getTabs | Retrieves all tabs in window |
getCurrentTab | Retrieves current active tab in window |
isActive | Returns true if the window is in focus now |
Returns window unique identifier.
Returns: | window unique identifier |
---|---|
Return type: | string |
Example:
kango.browser.windows.getCurrent(function(win) {
// win is KangoBrowserWindow object
kango.console.log(window.getId());
});
Retrieves all tabs in window and pass it to callback function.
Arguments: |
|
---|
Example:
// output number of tabs in current window.
kango.browser.windows.getCurrent(function(win) {
// win is KangoBrowserWindow object
win.getTabs(function(tabs) {
kango.console.log(tabs.length);
});
});
Retrieves current active tab in window and pass it to callback function.
Arguments: |
|
---|
Example:
// output url of current tab in current window.
kango.browser.windows.getCurrent(function(win) {
// win is KangoBrowserWindow object
win.getCurrentTab(function(tab) {
// tab is KangoBrowserTab object
kango.console.log(tab.getUrl());
});
});
Return true if window is in focus and false if it is not.
Returns: | true for active tab and false for not active |
---|---|
Return type: | boolean |
Example:
// Find active tab in active window and open http://example.com/ in it
kango.browser.windows.getAll(function(wins) {
// wins is an Array of KangoBrowserWindow objects
for (var i = 0; i < wins.length; i++) {
if (wins[i].isActive()) {
// wins[i] is KangoBrowserWindow object representing active window
wins[i].getCurrentTab(function(tab) {
// tab is KangoBrowserTab objects for active tab in active window
tab.navigate('http://example.com/');
});
}
}
});