diff --git a/nw.js/nw.js-tests.ts b/nw.js/nw.js-tests.ts
new file mode 100644
index 0000000000..585b7ebe3c
--- /dev/null
+++ b/nw.js/nw.js-tests.ts
@@ -0,0 +1,352 @@
+///
+/*
+ * nw.App Tests
+ */
+var argv = nw.App.argv;
+var fullArgv = nw.App.fullArgv;
+var filteredArgv = nw.App.filteredArgv;
+var dataPath = nw.App.dataPath;
+var manifest = nw.App.manifest;
+
+nw.App.clearCache();
+nw.App.closeAllWindows();
+nw.App.crashBrowser();
+nw.App.crashRenderer();
+nw.App.getProxyForURL( 'https://github.com/alirdn' );
+nw.App.setProxyConfig( 'http=foopy:80;ftp=foopy2' );
+nw.App.quit();
+nw.App.addOriginAccessWhitelistEntry( 'http://github.com/', 'chrome-extension', location.host, true );
+nw.App.removeOriginAccessWhitelistEntry( 'http://github.com/', 'chrome-extension', location.host, true );
+
+/*
+ * Note:
+ * nw.App.registerGlobalHotKey() tested in Shortcut Tests
+ * nw.App.unregisterGlobalHotKey() tested in Shortcut Tests
+ * */
+
+nw.App.on( 'open', function ( args ) {
+ console.log( args );
+});
+
+nw.App.on( 'reopen', function () {
+ console.log( 'reopened' );
+});
+
+/**
+ * nw.Clipboard Tests
+ */
+// get the system clipboard
+var clipboard = nw.Clipboard.get();
+// Read from clipboard
+var text = clipboard.get( 'text' );
+console.log( text );
+
+// Or write something
+clipboard.set( 'I love NW.js :)', 'text' );
+
+// And clear it!
+clipboard.clear();
+
+/**
+ * nw.Menu Tests
+ */
+// Create an empty context menu
+var menu = new nw.Menu();
+
+// Add some items
+menu.append( new nw.MenuItem( { label: 'Item A' }) );
+menu.append( new nw.MenuItem( { label: 'Item B' }) );
+menu.append( new nw.MenuItem( { type: 'separator' }) );
+menu.append( new nw.MenuItem( { label: 'Item C' }) );
+
+// Remove one item
+menu.removeAt( 1 );
+
+// Popup as context menu
+menu.popup( 10, 10 );
+
+// Iterate menu's items
+for ( var i = 0; i < menu.items.length; ++i ) {
+ console.log( menu.items[i] );
+}
+// Create an empty menubar
+var menu = new nw.Menu( { type: 'menubar' });
+
+// Create a submenu as the 2nd level menu
+var submenu = new nw.Menu();
+submenu.append( new nw.MenuItem( { label: 'Item A' }) );
+submenu.append( new nw.MenuItem( { label: 'Item B' }) );
+
+// Create and append the 1st level menu to the menubar
+menu.append( new nw.MenuItem( {
+ label: 'First Menu',
+ submenu: submenu
+}) );
+
+// Assign it to `window.menu` to get the menu displayed
+nw.Window.get().menu = menu;
+
+/**
+ * nw.MenuItem Tests
+ */
+var item: any;
+
+// Create a separator
+item = new nw.MenuItem( { type: 'separator' });
+
+// Create a normal item with label and icon
+item = new nw.MenuItem( {
+ type: "normal",
+ label: "I'm a menu item",
+ icon: "img/icon.png"
+});
+
+// Or you can omit the 'type' field for normal items
+item = new nw.MenuItem( { label: 'Simple item' });
+
+// Bind a callback to item
+item = new nw.MenuItem( {
+ label: "Click me",
+ click: function () {
+ console.log( "I'm clicked" );
+ },
+ key: "s",
+ modifiers: "ctrl+alt",
+});
+
+// You can have submenu!
+var submenu = new nw.Menu();
+submenu.append( new nw.MenuItem( { label: 'Item 1' }) );
+submenu.append( new nw.MenuItem( { label: 'Item 2' }) );
+submenu.append( new nw.MenuItem( { label: 'Item 3' }) );
+item.submenu = submenu;
+
+// And everything can be changed at runtime
+item.label = 'New label';
+item.click = function () {
+ console.log( 'New click callback' );
+};
+
+/**
+ * nw.Screen Tests
+ */
+//init must be called once during startup, before any function to nw.Screen can be called
+nw.Screen.Init();
+
+var screenCB = {
+ onDisplayBoundsChanged: function ( screen: any ) {
+ console.log( 'displayBoundsChanged', screen );
+ },
+
+ onDisplayAdded: function ( screen: any ) {
+ console.log( 'displayAdded', screen );
+ },
+
+ onDisplayRemoved: function ( screen: any ) {
+ console.log( 'displayRemoved', screen )
+ }
+};
+
+// listen to screen events
+nw.Screen.on( 'displayBoundsChanged', screenCB.onDisplayBoundsChanged );
+nw.Screen.on( 'displayAdded', screenCB.onDisplayAdded );
+nw.Screen.on( 'displayRemoved', screenCB.onDisplayRemoved );
+
+/**
+ * nw.Screen.chooseDesktopMedia() Tests
+ */
+nw.Screen.Init(); // you only need to call this once
+nw.Screen.chooseDesktopMedia( ["window", "screen"],
+ function ( streamId ) {
+ var vid_constraint = {
+ mandatory: {
+ chromeMediaSource: 'desktop',
+ chromeMediaSourceId: streamId,
+ maxWidth: 1920,
+ maxHeight: 1080
+ },
+ optional: []
+ };
+ //navigator.webkitGetUserMedia( { audio: false, video: constraint }, success_func, fallback_func );
+ }
+);
+
+/**
+ * nw.Screen.DesktopCaptureMonitor Tests
+ */
+var dcm = nw.Screen.DesktopCaptureMonitor;
+nw.Screen.Init();
+dcm.on( "added", function ( id, name, order, type ) {
+ //select first stream and shutdown
+ var constraints = {
+ audio: {
+ mandatory: {
+ chromeMediaSource: "system",
+ chromeMediaSourceId: dcm.registerStream( id )
+ }
+ },
+ video: {
+ mandatory: {
+ chromeMediaSource: 'desktop',
+ chromeMediaSourceId: dcm.registerStream( id )
+ }
+ }
+ };
+
+ // TODO: call getUserMedia with contraints
+
+ dcm.stop();
+});
+
+dcm.on( "removed", function ( id ) {
+});
+dcm.on( "orderchanged", function ( id, new_order, old_order ) {
+});
+dcm.on( "namechanged", function ( id, name ) {
+});
+dcm.on( "thumbnailchanged", function ( id, thumbnail ) {
+});
+dcm.start( true, true );
+
+/**
+ * nw.Shell Tests
+ */
+// Open URL with default browser.
+nw.Shell.openExternal( 'https://github.com/nwjs/nw.js' );
+
+// Open a text file with default text editor.
+nw.Shell.openItem( 'test.txt' );
+
+// Show a file in parent folder with file manager.
+nw.Shell.showItemInFolder( 'test.txt' );
+
+/**
+ * nw.Shortcut Tests
+ */
+var option = {
+ key: "Ctrl+Shift+A",
+ active: function () {
+ console.log( "Global desktop keyboard shortcut: " + this.key + " active." );
+ },
+ failed: function ( msg: any ) {
+ // :(, fail to register the |key| or couldn't parse the |key|.
+ console.log( msg );
+ }
+};
+
+// Create a shortcut with |option|.
+var shortcut = new nw.Shortcut( option );
+
+// Register global desktop shortcut, which can work without focus.
+nw.App.registerGlobalHotKey( shortcut );
+
+// If register |shortcut| successfully and user struck "Ctrl+Shift+A", |shortcut|
+// will get an "active" event.
+
+// You can also add listener to shortcut's active and failed event.
+shortcut.on( 'active', function () {
+ console.log( "Global desktop keyboard shortcut: " + this.key + " active." );
+});
+
+shortcut.on( 'failed', function ( msg: any ) {
+ console.log( msg );
+});
+
+// Unregister the global desktop shortcut.
+nw.App.unregisterGlobalHotKey( shortcut );
+
+/**
+ * nw.Tray Tests
+ */
+// Create a tray icon
+var tray = new nw.Tray( { title: 'Tray', icon: 'img/icon.png' });
+
+// Give it a menu
+var menu = new nw.Menu();
+menu.append( new nw.MenuItem( { type: 'checkbox', label: 'box1' }) );
+tray.menu = menu;
+
+// Remove the tray
+tray.remove();
+tray = null;
+
+/**
+ * nw.Window Tests
+ */
+// Get the current window
+var win = nw.Window.get();
+
+// Listen to the minimize event
+win.on( 'minimize', function () {
+ console.log( 'Window is minimized' );
+});
+
+// Minimize the window
+win.minimize();
+
+// Unlisten the minimize event
+win.removeAllListeners( 'minimize' );
+
+// Create a new window and get it
+nw.Window.open( 'https://github.com', {}, function ( new_win ) {
+ // And listen to new window's focus event
+ new_win.on( 'focus', function () {
+ console.log( 'New window is focused' );
+ });
+});
+
+// Get the current window
+var win = nw.Window.get();
+
+// Create a new window and get it
+nw.Window.open( 'https://github.com/nwjs/nw.js', {}, function ( new_win ) {
+ // do something with the newly created window
+});
+
+win.on( 'close', function () {
+ this.hide(); // Pretend to be closed already
+ console.log( "We're closing..." );
+ this.close( true ); // then close it forcely
+});
+
+win.close();
+
+// png as base64string
+win.capturePage( function ( base64string ) {
+ // do something with the base64string
+}, { format: 'png', datatype: 'raw' });
+
+// png as node buffer
+win.capturePage( function ( buffer ) {
+ // do something with the buffer
+}, { format: 'png', datatype: 'buffer' });
+
+// Open a new window.
+nw.Window.open( 'popup.html', {}, function ( win ) {
+
+ // Release the 'win' object here after the new window is closed.
+ win.on( 'closed', function () {
+ win = null;
+ });
+
+ // Listen to main window's close event
+ nw.Window.get().on( 'close', function () {
+ // Hide the window to give user the feeling of closing immediately
+ this.hide();
+
+ // If the new window is still open then close it.
+ if ( win != null )
+ win.close( true );
+
+ // After closing the new window, close the main window.
+ this.close( true );
+ });
+
+});
+
+nw.Window.get().on( 'new-win-policy', function ( frame, url, policy ) {
+ // do not open the window
+ policy.ignore();
+ // and open it in external browser
+ nw.Shell.openExternal( url );
+});
diff --git a/nw.js/nw.js.d.ts b/nw.js/nw.js.d.ts
new file mode 100644
index 0000000000..6ae2582e50
--- /dev/null
+++ b/nw.js/nw.js.d.ts
@@ -0,0 +1,1883 @@
+// Type definitions for nw.js v0.13.x and later
+// Project: http://nwjs.io
+// Definitions by: Alireza Dabiri Nejad
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+/**
+ * Helpers class and interfaces defined here, to make `nw` module cleaner.
+ */
+declare module NWJS_Helpers {
+
+ /**
+ * Node.js v6.x EventEmitter Class
+ */
+ class EventEmitter implements NodeJS.EventEmitter {
+ static EventEmitter: EventEmitter;
+
+ static listenerCount( emitter: EventEmitter, event: string ): number; // deprecated
+ static defaultMaxListeners: number;
+
+ addListener( event: string, listener: Function ): this;
+
+ on( event: string, listener: Function ): this;
+
+ once( event: string, listener: Function ): this;
+
+ removeListener( event: string, listener: Function ): this;
+
+ removeAllListeners( event?: string ): this;
+
+ setMaxListeners( n: number ): this;
+
+ getMaxListeners(): number;
+
+ listeners( event: string ): Function[];
+
+ emit( event: string, ...args: any[] ): boolean;
+
+ listenerCount( type: string ): number;
+ }
+
+ /**
+ * The clipboard object.
+ */
+ interface clip {
+
+ /**
+ * Write `data` of `type` to the clipboard.
+ *
+ * @param data {string} the data to write to the clipboard
+ * @param type {string} (Optional) the type of the data. Support text, png, jpeg, html and rtf. By default, type is set to "text".
+ * @param raw {boolean} (Optional) requiring raw image data. This option is only valid if type is png or jpeg. By default, raw is set to false.
+ */
+ set( data: string, type?: string, raw?: boolean ): void;
+
+ /**
+ * Get the data of `type` from clipboard.
+ *
+ * @param type {string} (Optional) the type of the data. Support text, png, jpeg, html and rtf. By default, type is set to "text".
+ * @param raw {boolean} (Optional) requiring raw image data. This option is only valid if type is png or jpeg.
+ * @returns {string} the data retrieved from the clipboard.
+ */
+ get( type?: string, raw?: boolean ): string;
+
+ /**
+ * Get an array contains list of available types of data in clipboard currenly.
+ * You can use the returned list as a suggestion to get the right data from clipboard.
+ *
+ * @returns {string[]} List of available types of data in clipboard currenly.
+ */
+ readAvailableTypes(): string[];
+
+ /**
+ * Clear the clipboard.
+ */
+ clear(): void;
+ }
+
+ /**
+ * Object that contains options to use while creation of nw.Menu. example: new nw.Menu(MenuOption)
+ */
+ interface MenuOption {
+ /**
+ * {string} (Optional) two types are accepted by this method: "menubar" or "contextmenu". The value is set to "contextmenu" by default.
+ */
+ type: string;
+ }
+
+ /**
+ * Options to modify default `edit` and `window` MenuItems in Mac.
+ */
+ interface CreateMacBuiltinOption {
+
+ /**
+ * {Boolean} (Optional) do not populate the Edit menu
+ */
+ hideEdit?: boolean;
+
+ /**
+ * {Boolean} (Optional) do not populate the Window menu
+ */
+ hideWindow?: boolean;
+ }
+
+ /**
+ * Options for MenuItem.
+ */
+ interface MenuItemOption {
+
+ /**
+ * {string} (Optional) Label for normal item or checkbox
+ */
+ label?: string;
+
+ /**
+ * {string} (Optional) Icon for normal item or checkbox
+ */
+ icon?: string;
+
+ /**
+ * {string} (Optional) Tooltip for normal item or checkbox
+ */
+ tooltip?: string;
+
+ /**
+ * {string} (Optional) The type of the item. Three types are accepted: normal, checkbox, separator
+ */
+ type?: string | "normal" | "checkbox" | "separator";
+
+ /**
+ * {Function} (Optional) The callback function when item is triggered by mouse click or keyboard shortcut
+ */
+ click?: Function;
+
+ /**
+ * {boolean} (Optional) Whether the item is enabled or disabled. It"s set to true by default.
+ */
+ enabled?: boolean;
+
+ /**
+ * {boolean} (Optional) Whether the checkbox is checked or not. It"s set to false by default.
+ */
+ checked?: boolean;
+
+ /**
+ * {nw.Menu} (Optional) A submenu
+ */
+ submenu?: nw.Menu;
+
+ /**
+ * {string} (Optional) The key of the shortcut
+ */
+ key?: string;
+
+ /**
+ * {string} (Optional) The modifiers of the shortcut
+ */
+ modifiers?: string;
+ }
+
+ /**
+ * nw.Screen screen object
+ */
+ interface screen {
+
+ /**
+ * Unique id for a screen
+ */
+ id: number,
+
+ /**
+ * Physical screen resolution, can be negative, not necessarily start from 0,depending on screen arrangement
+ */
+ bounds: {
+ x: number,
+ y: number,
+ width: number,
+ height: number
+ },
+
+ /**
+ * Useable area within the screen bound
+ */
+ work_area: {
+ x: number,
+ y: number,
+ width: number,
+ height: number
+ },
+
+ scaleFactor: number,
+
+ isBuiltIn: boolean,
+
+ rotation: number,
+
+ touchSupport: number
+ }
+
+ /**
+ * This API behaves similar functions as Screen.chooseDesktopMedia. But it doesn"t have GUI.
+ */
+ interface DesktopCaptureMonitor extends EventEmitter {
+
+ /**
+ * Boolean of whether the DesktopCaptureMonitor is started.
+ */
+ started: boolean;
+
+ /**
+ * The DesktopCaptureMonitor will start monitoring the system and trigger the the events.
+ *
+ * @param should_include_screens {boolean} Whether should include screens
+ * @param should_include_windows {boolean} Whether should include windows
+ */
+ start( should_include_screens: boolean, should_include_windows: boolean ): void;
+
+ /**
+ * The DesktopCaptureMonitor will stop monitoring the system.
+ */
+ stop(): void;
+
+ /**
+ * Register and return a valid stream id passed into chromeMediaSourceId in getUserMedia constraints.
+ *
+ * @param id {string} valid stream id.
+ */
+ registerStream( id: string ): void;
+
+ on( event: string, listener: Function ): this;
+
+ /**
+ * Emit when a new source was added.
+ *
+ * @param event {string} Event name
+ * @param listener {Function(id?,name?,order?,type?,primary?)} The callback that handles the `added` event.
+ * - (optional) id {string} Is the media id.
+ * - (optional) name {string} Is the title of the window or screen.
+ * - (optional) order {number} Is the z-order of the windows, if screens are selected they will appear first.
+ * - (optional) type {string} Type of the stream: "screen", "window", "other" or "unknown".
+ * - (optional) primary {boolean} This will be true if the source is the primary monitor. (Windows OS only)
+ */
+ on( event: 'added', listener: ( id?: string, name?: string, order?: number, type?: string, primary?: boolean ) => any ): this;
+
+ /**
+ * Emit when a source was removed.
+ *
+ * @param event {string} Event name
+ * @param listener {Function(order?)} The callback that handles the `remove` event.
+ * - (optional) order {number} Is the order of the media source that is no longer capturable.
+ */
+ on( event: 'removed', listener: ( order?: number ) => any ): this;
+
+ /**
+ * Emit when the Z-order of a source changed (this may change for windows as others are focused).
+ *
+ * @param event {string} Event name
+ * @param listener {Function(id?,new_order?,old_order?)} The callback that handles the `orderchanged` event.
+ * - (optional) id {string} Is the media id of the screen or window that has changed z-order.
+ * - (optional) new_order {number} Is the new z-order.
+ * - (optional) old_order {number} Is the old z-order.
+ */
+ on( event: 'orderchanged', listener: ( id?: string, new_order?: number, old_order?: number ) => any ): this;
+
+ /**
+ * Emit when the name of the source has changed. This can happen when a window changes title.
+ *
+ * @param event {string} Event name
+ * @param listener {Function(id?,new_order?,old_order?)} The callback that handles the `namechanged ` event.
+ * - (optional) id {string} Is the media id of the screen or window that has a name changed.
+ * - (optional) name {string} Is the new name of the screen or window.
+ */
+ on( event: 'namechanged', listener: ( id?: string, name?: string ) => any ): this;
+
+ /**
+ * Emit when the thumbnail of a source changed.
+ *
+ * @param event {string} Event name
+ * @param listener {Function(id?,new_order?,old_order?)} The callback that handles the `thumbnailchanged ` event.
+ * - (optional) id {string} Is the media id of the screen or window that has an updated thumbnail.
+ * - (optional) name {string} Is the base64 encoded png of the thumbnail.
+ */
+ on( event: 'thumbnailchanged', listener: ( id?: string, thumbnail?: string ) => any ): this;
+ }
+
+ /**
+ * Shortcut option is an object contains initial settings for the Shortcut.
+ */
+ interface ShortcutOption {
+
+ /**
+ * {Function} (Optional) A callback when the hotkey is triggered.
+ */
+ active: Function;
+
+ /**
+ * {Function} (Optional) A callback when failed to register the hotkey.
+ *
+ * @param msg {string} Failure message
+ */
+ failed: ( msg?: string ) => any;
+
+ /**
+ * {string} Key combinations of the shortcut, such as "ctrl+shift+a".
+ */
+ key: string;
+ }
+
+ /**
+ * Option for tray that contains initial settings for the Tray.
+ */
+ interface TrayOption {
+
+ /**
+ * {string} title
+ */
+ title?: string;
+
+ /**
+ * {string} tooltip
+ */
+ tooltip?: string;
+
+ /**
+ * {string} icon
+ */
+ icon?: string;
+
+ /**
+ * {string} alternate
+ */
+ alticon?: string;
+
+ /**
+ * {boolean} whether icons are templates
+ */
+ iconsAreTemplates?: boolean;
+
+ /**
+ * {Menu} popup menu
+ */
+ menu?: nw.Menu;
+ }
+
+ /**
+ * Options for nw.Window.get().print().
+ */
+ interface PrintOption {
+
+ /**
+ * The device name of the printer
+ */
+ printer: string;
+
+ /**
+ * The path of the output PDF when printing to PDF
+ */
+ pdf_path: string;
+
+ /**
+ * Whether to enable header and footer
+ */
+ headerFooterEnabled: boolean;
+
+ /**
+ * Whether to use landscape or portrait
+ */
+ landscape: boolean;
+
+ /**
+ * The paper size spec
+ * example: 'mediaSize':{'name': 'CUSTOM', 'width_microns': 279400, 'height_microns': 215900, 'custom_display_name':'Letter', 'is_default': true}
+ */
+ mediaSize: JSON;
+
+ /**
+ * Whether to print CSS backgrounds
+ */
+ shouldPrintBackgrounds: boolean;
+ }
+
+ /**
+ * Config for nw.Window.get().capturePage().
+ */
+ interface CapturePageConfig {
+
+ /**
+ * (Optional) The image format used to generate the image. It supports two formats: "png" and "jpeg". If ignored, it’s "jpeg" by default.
+ */
+ format?: string
+
+ /**
+ * (Optional) It supports three types: "raw", "buffer" and "datauri". If ignored, it’s "datauri" by default.
+ */
+ datatype?: string
+ }
+
+ /**
+ * This includes multiple functions to manipulate the cookies.
+ */
+ interface Cookies {
+
+ /**
+ * Retrieves information about a single cookie.
+ *
+ * @param details {Objet} Details to identify the cookie being retrieved.
+ * @param callback {function(cookie?)} The callback when cookie retrieved.
+ * - (Optional) cookie {Cookie} Contains details about the cookie. This parameter is null if no such cookie was found.
+ */
+ get( details: CookiesGetDetails, callback: ( cookie?: Cookie ) => void ): void;
+
+ /**
+ * Retrieves all cookies from a single cookie store that match the given information.
+ *
+ * @param details {Objet} Information to filter the cookies being retrieved.
+ * @param callback {function(cookies?)} The callback when cookies retrieved.
+ * - (Optional) cookies {Cookie[]} All the existing, unexpired cookies that match the given cookie info.
+ */
+ getAll( details: CookiesGetAllDetails, callback: ( cookies?: Cookie[] ) => void ): void;
+
+ /**
+ * Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
+ *
+ * @param details {Objet} Details about the cookie being set.
+ * @param callback {function(cookie?)} The callback when cookie has been set.
+ * - (Optional) cookie {Cookie} Contains details about the cookie that's been set. If setting failed for any reason, this will be "null", and "chrome.runtime.lastError" will be set.
+ */
+ set( details: CookiesSetDetails, callback: ( cookie?: Cookie ) => void ): void;
+
+ /**
+ * Deletes a cookie by name.
+ *
+ * @param details {Objet} Information to identify the cookie to remove.
+ * @param callback {function(cookie?)} The callback when cookie has been set.
+ * - (Optional) details {Objet} Contains details about the cookie that's been removed. If removal failed for any reason, this will be "null", and "chrome.runtime.lastError" will be set.
+ */
+ remove( details: CookiesRemoveDetails, callback: ( details?: CookiesRemovedDetails ) => void ): void;
+
+ /**
+ * Fired when a cookie is set or removed.
+ */
+ onChanged: {
+ /**
+ * Add a new listener for onChanged event.
+ *
+ * @param callback {function(changeInfo?)} The callback when cookie has been changed.
+ * - (Optional) changeInfo {Objet} Contains details about the cookie that's been changed.
+ */
+ addListener( callback: ( changeInfo: CookiesOnChangedCallbackChangeInfo ) => void ): void;
+ }
+ }
+
+ /**
+ * Represents information about an HTTP cookie.
+ */
+ interface Cookie {
+
+ /**
+ * The name of the cookie.
+ */
+ name: string;
+
+ /**
+ * The value of the cookie.
+ */
+ value: string;
+
+ /**
+ * The domain of the cookie (e.g. "www.google.com", "example.com").
+ */
+ domain: string;
+
+ /**
+ * True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie).
+ */
+ hostOnly: boolean;
+
+ /**
+ * The path of the cookie.
+ */
+ path: string;
+
+ /**
+ * True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS).
+ */
+ secure: boolean;
+
+ /**
+ * True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts).
+ */
+ httpOnly: boolean;
+
+ /**
+ * The cookie's same-site status (i.e. whether the cookie is sent with cross-site requests).
+ */
+ sameSite: string | "no_restriction" | "lax" | "strict";
+
+ /**
+ * True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date.
+ */
+ session: boolean;
+
+ /**
+ * (Optional) The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.
+ */
+ expirationDate?: number;
+
+ /**
+ * The ID of the cookie store containing this cookie.
+ */
+ storeId: string;
+ }
+
+ /**
+ * Coockies.get() details argument object
+ */
+ interface CookiesGetDetails {
+
+ /**
+ * The URL with which the cookie to retrieve is associated.
+ */
+ url: string;
+
+ /**
+ * The name of the cookie to retrieve.
+ */
+ name: string;
+
+ /**
+ * The ID of the cookie store in which to look for the cookie.
+ */
+ storeId: string;
+ }
+
+ /**
+ * Coockies.getAll() details argument object
+ */
+ interface CookiesGetAllDetails {
+
+ /**
+ * Restricts the retrieved cookies to those that would match the given URL.
+ */
+ url?: string;
+
+ /**
+ * Filters the cookies by name.
+ */
+ name?: string;
+
+ /**
+ * Restricts the retrieved cookies to those whose domains match or are subdomains of this one.
+ */
+ domain?: string;
+
+ /**
+ * Restricts the retrieved cookies to those whose path exactly matches this string.
+ */
+ path?: string;
+
+ /**
+ * Filters the cookies by their Secure property.
+ */
+ secure?: boolean;
+
+ /**
+ * Filters out session vs. persistent cookies.
+ */
+ session: boolean;
+
+ /**
+ * The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used.
+ */
+ storeId?: string;
+ }
+
+ /**
+ * Coockies.set() details argument object
+ */
+ interface CookiesSetDetails {
+
+ /**
+ * The request-URI to associate with the setting of the cookie.
+ */
+ url: string;
+
+ /**
+ * The name of the cookie. Empty by default if omitted.
+ */
+ name?: string;
+
+ /**
+ * The value of the cookie. Empty by default if omitted.
+ */
+ value?: string;
+
+ /**
+ * The domain of the cookie. If omitted, the cookie becomes a host-only cookie.
+ */
+ domain?: string;
+
+ /**
+ * The path of the cookie. Defaults to the path portion of the url parameter.
+ */
+ path?: string;
+
+ /**
+ * Whether the cookie should be marked as Secure. Defaults to false.
+ */
+ secure?: boolean;
+
+ /**
+ * Whether the cookie should be marked as HttpOnly. Defaults to false.
+ */
+ httpOnly?: boolean;
+
+ /**
+ * The cookie's same-site status: defaults to 'no_restriction'.
+ */
+ sameSite?: string | "no_restriction" | "lax" | "strict";
+
+ /**
+ * The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie.
+ */
+ expirationDate?: number;
+
+ /**
+ * The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store.
+ */
+ storeId?: string;
+ }
+
+ /**
+ * Coockies.remove() details argument object
+ */
+ interface CookiesRemoveDetails {
+
+ /**
+ * The URL associated with the cookie.
+ */
+ url: string;
+
+ /**
+ * The name of the cookie to remove.
+ */
+ name: string;
+
+ /**
+ * The ID of the cookie store to look in for the cookie.
+ */
+ storeId: string;
+ }
+
+ /**
+ * Coockies.remove() callback details argument object
+ */
+ interface CookiesRemovedDetails {
+
+ /**
+ * The URL associated with the cookie that's been removed.
+ */
+ url: string;
+
+ /**
+ * The name of the cookie that's been removed.
+ */
+ name: string;
+
+ /**
+ * The ID of the cookie store from which the cookie was removed.
+ */
+ storeId: string;
+ }
+
+ /**
+ * Coockies.onChanged.addListener() callback details argument object
+ */
+ interface CookiesOnChangedCallbackChangeInfo {
+
+ /**
+ * True if a cookie was removed.
+ */
+ removed: boolean;
+
+ /**
+ * Information about the cookie that was set or removed.
+ */
+ cookie: Cookie;
+
+ /**
+ * The underlying reason behind the cookie's change.
+ */
+ cause: string | "evicted" | "expired" | "explicit" | "expired_overwrite" | "overwrite"
+ }
+
+ /**
+ * nw.Window.get().on('new-win-policy') callback policy argument object
+ */
+ interface WinPolicy {
+
+ /**
+ * Ignore the request, navigation won’t happen.
+ */
+ ignore(): void;
+
+ /**
+ * Force the link to be opened in the same frame
+ */
+ forceCurrent(): void;
+
+ /**
+ * Force the link to be a downloadable, or open by external program
+ */
+ forceDownload(): void;
+
+ /**
+ * Force the link to be opened in a new window
+ */
+ forceNewWindow(): void;
+
+ /**
+ * Force the link to be opened in a new popup window
+ */
+ forceNewPopup(): void;
+
+ /**
+ * Control the options for the new popup window.
+ *
+ *@param m {Object} The object is in the same format as the Window subfields in manifest format.
+ */
+ setNewWindowManifest( m: WindowOption ): void;
+ }
+
+ /**
+ * nw.Window Option that is in the same format as the Window subfields in manifest format.
+ */
+ interface WindowOption {
+
+ /**
+ * The id used to identify the window.
+ */
+ id?: string;
+
+ /**
+ * The default title of window created by NW.js
+ */
+ title?: string;
+
+ /**
+ * The initial width of the main window.
+ */
+ width?: number;
+
+ /**
+ * The initial height of the main window.
+ */
+ height?: number;
+
+ /**
+ * Path to window’s icon
+ */
+ icon?: string;
+
+ /**
+ * Controls where window will be put, be `null` or `center` or `mouse`
+ */
+ position?: string;
+
+ /**
+ * Minimum width of window
+ */
+ min_width?: number;
+
+ /**
+ * Minimum height of window
+ */
+ min_height?: number;
+
+ /**
+ * Maximum width of window
+ */
+ max_width?: number;
+
+ /**
+ * Maximum height of window
+ */
+ max_height?: number;
+
+ /**
+ * Show as desktop background window under X11 environment
+ */
+ as_desktop?: boolean;
+
+ /**
+ * Whether window is resizable
+ */
+ resizable?: boolean;
+
+ /**
+ * Whether the window should always stay on top of other windows.
+ */
+ always_on_top?: boolean;
+
+ /**
+ * Whether the window should be visible on all workspaces simultaneously (on platforms that support multiple workspaces, currently Mac OS X and Linux).
+ */
+ visible_on_all_workspaces?: boolean;
+
+ /**
+ * Whether window is fullscreen
+ */
+ fullscreen?: boolean;
+
+ /**
+ * Whether the window is shown in taskbar or dock. The default is true.
+ */
+ show_in_taskbar?: boolean;
+
+ /**
+ * Specify it to false to make the window frameless
+ */
+ frame?: boolean;
+
+ /**
+ * Specify it to false if you want your app to be hidden on startup
+ */
+ show?: boolean;
+
+ /**
+ * Whether to use Kiosk mode.
+ */
+ kiosk?: boolean;
+
+ /**
+ * Whether to turn on transparent window mode.
+ */
+ transparent?: boolean;
+ }
+
+ interface WindowOpenOption extends WindowOption {
+
+ /**
+ * (Optional) Whether to open a new window in a separate render process.
+ */
+ new_instance?: boolean;
+
+ /**
+ * (Optional) The script to be injected before document loaded.
+ */
+ inject_js_start?: string;
+
+ /**
+ * (Optional) The script to be injected before document unloaded.
+ */
+ inject_js_end?: string;
+
+ /**
+ * (Optional) The id used to identify the window.
+ */
+ id?: string;
+ }
+
+ /**
+ * nw.Window.get().on('navigation') callback policy argument object
+ */
+ interface WinNavigationPolicy {
+
+ /**
+ * Ignore the request, navigation won’t happen.
+ */
+ ignore(): void;
+ }
+
+ interface win extends EventEmitter {
+
+ /**
+ * Get the corresponding DOM window object of the native window.
+ */
+ window: Object;
+
+ /**
+ * Get or set left offset from window to screen.
+ */
+ x: number;
+
+ /**
+ * Get or set top offset from window to screen.
+ */
+ y: number;
+
+ /**
+ * Get or set window's width.
+ */
+ width: number;
+
+ /**
+ * Get or set window's height.
+ */
+ height: number;
+
+ /**
+ * Get or set window's title.
+ */
+ title: string;
+
+ /**
+ * Get or set window's menubar.
+ */
+ menu: nw.Menu;
+
+ /**
+ * Get whether we're in fullscreen mode.
+ */
+ isFullscreen: boolean;
+
+ /**
+ * Get whether transparency is turned on
+ */
+ isTransparent: boolean;
+
+ /**
+ * Get whether we're in kiosk mode.
+ */
+ isKioskMode: boolean;
+
+ /**
+ * Get or set the page zoom.
+ */
+ zoomLevel: number;
+
+ /**
+ * This includes multiple functions to manipulate the cookies.
+ */
+ cookies: Cookies;
+
+ /**
+ * Moves a window's left and top edge to the specified coordinates.
+ *
+ * @param x {Integer} Offset to the left of the screen
+ * @param y {Integer} Offset to the top of the screen
+ */
+ moveTo( x: number, y: number ): void;
+
+ /**
+ * Moves a window a specified number of pixels relative to its current coordinates.
+ *
+ * @param x {Integer} Horizontal offset
+ * @param y {Integer} Vertical offset
+ */
+ moveBy( x: number, y: number ): void;
+
+ /**
+ * Resizes a window to the specified width and height.
+ *
+ * @param width {Integer} The width of the window
+ * @param height {Integer} The height of the window
+ */
+ resizeTo( width: number, height: number ): void;
+
+ /**
+ * Resizes a window by the specified amount.
+ *
+ * @param width {Integer} The offset width of the window
+ * @param height {Integer} The offset height of the window
+ */
+ resizeBy( width: number, height: number ): void;
+
+ /**
+ * Focus on the window.
+ */
+ focus(): void;
+
+ /**
+ * Move focus away.
+ */
+ blur(): void;
+
+ /**
+ * Show the window if it's not shown.
+ *
+ * @param is_show {boolean} (Optional) Specify whether the window should be shown or hidden. It's set to true by default.
+ */
+ show( is_show?: boolean ): void;
+
+ /**
+ * Hide the window.
+ */
+ hide(): void;
+
+ /**
+ * Close current window.
+ *
+ * @param force {boolean} (Optional) Specify whether to close the window forcely and bypass close event.
+ */
+ close( force?: boolean ): void;
+
+ /**
+ * Reloads the current window.
+ */
+ reload(): void;
+
+ /**
+ * Reloads the current page by starting a new renderer process from scratch.
+ */
+ reloadDev(): void;
+
+ /**
+ * Like reload(), but don't use caches (aka 'shift-reload').
+ */
+ reloadIgnoringCache(): void;
+
+ /**
+ * Maximize the window on GTK and Windows, and zoom the window on Mac OS X.
+ */
+ maximize(): void;
+
+ /**
+ * Minimize the window to task bar on Windows, iconify the window on GTK, and miniaturize the window on Mac OS X.
+ */
+ minimize(): void;
+
+ /**
+ * Restore window to previous state after the window is minimized.
+ */
+ restore(): void;
+
+ /**
+ * Make the window fullscreen.
+ */
+ enterFullscreen(): void;
+
+ /**
+ * Leave the fullscreen mode.
+ */
+ leaveFullscreen(): void;
+
+ /**
+ * Toggle the fullscreen mode.
+ */
+ toggleFullscreen(): void;
+
+ /**
+ * Enter the Kiosk mode.
+ */
+ enterKioskMode(): void;
+
+ /**
+ * Leave the Kiosk mode.
+ */
+ leaveKioskMode(): void;
+
+ /**
+ * Toggle the kiosk mode.
+ */
+ toggleKioskMode(): void;
+
+ /**
+ * Open the devtools to inspect the window.
+ *
+ * @param iframe {Integer} (Optional) the id or the element of the