-
-
Save sanusart/87b870154b1ca8ae4f4f to your computer and use it in GitHub Desktop.
Revisions
-
sanusart revised this gist
Apr 15, 2015 . No changes.There are no files selected for viewing
-
Julien Le Coupanec revised this gist
Jul 17, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -79,3 +79,5 @@ window.moveBy(x,y); // Moves a window a specified number of pixels r // https://github.com/rogerwang/node-webkit/wiki/Transfer-objects-between-window-and-node // 9. Building Node-Webkit. // https://github.com/rogerwang/node-webkit/wiki/Building-node-webkit -
Julien Le Coupanec revised this gist
Jul 17, 2014 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -74,3 +74,8 @@ window.moveBy(x,y); // Moves a window a specified number of pixels r // 7. Crash Dump. // https://github.com/rogerwang/node-webkit/wiki/Crash-dump // 8. Transfer Objects Between Window and Node. // https://github.com/rogerwang/node-webkit/wiki/Transfer-objects-between-window-and-node -
Julien Le Coupanec revised this gist
Jul 17, 2014 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -69,3 +69,8 @@ window.moveBy(x,y); // Moves a window a specified number of pixels r // 6.5. NeDB. // https://github.com/louischatriot/nedb // 7. Crash Dump. // https://github.com/rogerwang/node-webkit/wiki/Crash-dump -
Julien Le Coupanec revised this gist
Jul 17, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,7 @@ # Download: https://github.com/rogerwang/node-webkit#downloads # Old Versions: https://github.com/rogerwang/node-webkit/wiki/Downloads-of-old-versions # Wiki: https://github.com/rogerwang/node-webkit/wiki # How: https://github.com/rogerwang/node-webkit/wiki/How-node.js-is-integrated-with-chromium # 1. Run your application. -
Julien Le Coupanec revised this gist
Jul 17, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -51,7 +51,7 @@ window.moveBy(x,y); // Moves a window a specified number of pixels r // 6. Save Persistent Data in App. // It's very common to store persistent data in native apps, people usually do it by embedding external databases or manipulating plain text files. // In node-webkit, you have much better choices than that, you can use Web SQL Database, embedded databases, Web Storage (localStorage and sessionStorage) or Application Cache without headaches of any extra dependencies. // https://github.com/rogerwang/node-webkit/wiki/Save-persistent-data-in-app -
Julien Le Coupanec revised this gist
Jul 17, 2014 . 1 changed file with 21 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,3 +48,24 @@ window.resizeBy(width,height); // Resizes a window by the specified amount. window.moveTo(x,y); // Moves a window's left and top edge to the specified coordinates. window.moveBy(x,y); // Moves a window a specified number of pixels relative to its current coordinates. // 6. Save Persistent Data in App. // It's very common to store persistent data in native apps, people usually do it by embedding external databases or manipulating plain text files. // In node-webkit, you have much better choices than that, you can use Web SQL Database, embedded databases, Web Storage or Application Cache without headaches of any extra dependencies. // https://github.com/rogerwang/node-webkit/wiki/Save-persistent-data-in-app // 6.1. Web SQL Database. // http://html5doctor.com/introducing-web-sql-databases/ // 6.2. IndexedDB. (you might prefer using an abstraction, like PouchDB) // https://developer.mozilla.org/en-US/docs/IndexedDB // 6.3. PouchDB. // http://pouchdb.com/ // 6.4. EJDB. // https://github.com/Softmotions/ejdb // 6.5. NeDB. // https://github.com/louischatriot/nedb -
Julien Le Coupanec revised this gist
Jul 17, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ # Node-WebKit CheatSheet # Download: https://github.com/rogerwang/node-webkit#downloads # Old Versions: https://github.com/rogerwang/node-webkit/wiki/Downloads-of-old-versions # Wiki: https://github.com/rogerwang/node-webkit/wiki -
Julien Le Coupanec revised this gist
Jul 17, 2014 . 1 changed file with 16 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,4 +32,19 @@ var fs = require('fs'); fs.watch(path, function() { if (location) location.reload(); }); // 5. Play with Window. // https://github.com/rogerwang/node-webkit/wiki/Play-with-window window.open(URL,name,specs); // Create a new window. window.close(); // Close a window. window.focus(); // Focus on a window. window.blur(); // Blur on a window. window.resizeTo(width,height); // Resizes a window to the specified width and height. window.resizeBy(width,height); // Resizes a window by the specified amount. window.moveTo(x,y); // Moves a window's left and top edge to the specified coordinates. window.moveBy(x,y); // Moves a window a specified number of pixels relative to its current coordinates. -
Julien Le Coupanec revised this gist
Jul 17, 2014 . 1 changed file with 14 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,3 +19,17 @@ $('#main').load('views/user.html#zcbenz'); // The `global` variable is also useful for apps that have multiple windows. // Every opened window will share a same `global`, so you can use it to transfer messages across different windows. // More: https://github.com/rogerwang/node-webkit/wiki/about-node.js-server-side-script-in-node-webkit#page-navigation-and-multiple-windows // 4. Livereload Node-Webkit on Changes. // https://github.com/rogerwang/node-webkit/wiki/Livereload-node-webkit-on-changes // Add this script tag to the end of your main file: var path = './'; var fs = require('fs'); fs.watch(path, function() { if (location) location.reload(); }); -
Julien Le Coupanec revised this gist
Jul 17, 2014 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,3 +48,6 @@ nwsnapshot --extra_code source.js snapshot.bin # JS source code is compiled to # Then, add the following field to package.json: "snapshot" : "snapshot.bin" # 5. Application Auto Building Scripts for Linux Windows and OSX. # https://github.com/rogerwang/node-webkit/wiki/Application-auto-building-scripts-for-Linux-Windows-and-OSX -
Julien Le Coupanec revised this gist
Jul 15, 2014 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,3 +38,13 @@ cat /usr/bin/nw app.nw > app && chmod +x app ./nw path_to_app_dir --url="website-url" # Directly open "website-url". ./nw path_to_app_dir --no-toolbar # Force disabling toolbar. ./nw path_to_app_dir --data-path # Override the default data path (where cookies and localStorage etc. resides). # 4. Compile to Native Code and Protect JavaScript Source Code. # https://github.com/rogerwang/node-webkit/wiki/Protect-JavaScript-source-code-with-v8-snapshot nwsnapshot --extra_code source.js snapshot.bin # JS source code is compiled to native code (aka. 'snapshot'). # Then, add the following field to package.json: "snapshot" : "snapshot.bin" -
Julien Le Coupanec revised this gist
Jul 15, 2014 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -220,3 +220,12 @@ gui.Shell.openExternal(URI); // Open the given external protocol URI gui.Shell.openItem(file_path); // Open the given file_path in the desktop's default manner. gui.Shell.showItemInFolder(file_path); // Show the given file_path in a file manager. If possible, select the file. // 1.8. Process. // https://github.com/rogerwang/node-webkit/wiki/Changes-related-to-node process.versions['node-webkit']; // Get version of node webkit in app. And to quickly know the node-webkit's version you are using now, you can type nw:version in the toolbar. process.versions['chromium']; // Get the chromium version which node-webkit is based on. process.mainModule; // Get the start page (such as index.html) as specified in the manifest. -
Julien Le Coupanec revised this gist
Jul 15, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,6 +16,6 @@ $('#main').load('views/user.html#zcbenz'); // 3. Global Variable. // The `global` variable is also useful for apps that have multiple windows. // Every opened window will share a same `global`, so you can use it to transfer messages across different windows. // More: https://github.com/rogerwang/node-webkit/wiki/about-node.js-server-side-script-in-node-webkit#page-navigation-and-multiple-windows -
Julien Le Coupanec revised this gist
Jul 15, 2014 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,3 +14,8 @@ $('#main').load('views/user.html#zcbenz'); // The basic idea is: use the template engine to generate contents on the fly, and then append dynamic contents into the DOM. // More: https://github.com/rogerwang/node-webkit/wiki/about-node.js-server-side-script-in-node-webkit#template-engine // 3. Global Variable. // The global variable is also useful for apps that have multiple windows. // Every opened window will share a same global, so you can use it to transfer messages across different windows. // More: https://github.com/rogerwang/node-webkit/wiki/about-node.js-server-side-script-in-node-webkit#page-navigation-and-multiple-windows -
Julien Le Coupanec revised this gist
Jul 15, 2014 . 1 changed file with 8 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,16 @@ // Node-Webkit Tricks. // 1. Router. // You don't need a router in node-webkit, because you already have a better one: the file: protocol. // More: https://github.com/rogerwang/node-webkit/wiki/about-node.js-server-side-script-in-node-webkit#router // However the recommended way is not opening a new window or changing the `window.location`, you should just replace part of your page with ajax, like below. // In this way users won't have bad experience feeling refreshing the page, and the current javascript context is also kept. $('#main').load('views/user.html#zcbenz'); // 2. Template Engine. // The basic idea is: use the template engine to generate contents on the fly, and then append dynamic contents into the DOM. // More: https://github.com/rogerwang/node-webkit/wiki/about-node.js-server-side-script-in-node-webkit#template-engine -
Julien Le Coupanec revised this gist
Jul 15, 2014 . 2 changed files with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ // Node-Webkit Tricks. // You don't need a router in node-webkit, because you already have a better one: the file: protocol. // More: https://github.com/rogerwang/node-webkit/wiki/about-node.js-server-side-script-in-node-webkit#router // However the recommended way is not opening a new window or changing the `window.location`, you should just replace part of your page with ajax, like below. // In this way users won't have bad experience feeling refreshing the page, and the current javascript context is also kept. $('#main').load('views/user.html#zcbenz'); File renamed without changes. -
Julien Le Coupanec revised this gist
Jul 15, 2014 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,3 +29,12 @@ cat /usr/bin/nw app.nw > app && chmod +x app # Max OSX: Making an executable file out of a .nw file. # https://github.com/rogerwang/node-webkit/wiki/How-to-package-and-distribute-your-apps#mac-os-x # 3. Command Lines Switches. # https://github.com/rogerwang/node-webkit/wiki/Command-line-switches#--urlwebsite-url ./nw path_to_app_dir --url="website-url" # Directly open "website-url". ./nw path_to_app_dir --no-toolbar # Force disabling toolbar. ./nw path_to_app_dir --data-path # Override the default data path (where cookies and localStorage etc. resides). -
Julien Le Coupanec revised this gist
Jul 13, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -190,6 +190,8 @@ clipboard.clear(); // Clear the clipboard. // 1.6. Tray. // https://github.com/rogerwang/node-webkit/wiki/Tray // See also: Minimize to tray. // https://github.com/rogerwang/node-webkit/wiki/Minimize-to-tray var tray = new gui.Tray({ // Create a new Tray, option is an object contains initial settings for the Tray. -
Julien Le Coupanec revised this gist
Jul 11, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -134,7 +134,7 @@ var menuItem = new gui.MenuItem({ // Create new MenuItem. key: "s", // A single character string to specify the shortcut key for the menu item. submenu: null, // Submenu of a MenuItem, the submenu must be a Menu object. modifiers: "ctrl-alt", click: function() { // Emitted when user activates the menu item. console.log('clicked!'); }, }); -
Julien Le Coupanec revised this gist
Jul 11, 2014 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -125,14 +125,14 @@ menu.createMacBuiltin(appname); // OSX only. Create the default menus (App, var menuItem = new gui.MenuItem({ // Create new MenuItem. type: "normal", // Can also be "separator", "checkbox". A MenuItem's type can be set only when you create it, it cannot be changed at runtime. label: "I'm a menu item", // Label of the MenuItem. It can only be plain text for now. icon: "img/icon.png" // Icon of the MenuItem. It can be a relative path which points to an icon in your app, or an absolute path pointing to a file in user's system. tooltip: "Hey!" // Tooltip of the MenuItem. A tooltip is short string that describes the menu item, it will show when you hover your mouse on the item. checked: false, // Whether the MenuItem is checked. Usually if a MenuItem is checked, there will be a mark on the left side of it. It's used mostly to indicate whether an option is on. enabled: true, // Whether the MenuItem is enabled. An disabled MenuItem will be greyed out and you will not be able to click on it. key: "s", // A single character string to specify the shortcut key for the menu item. submenu: null, // Submenu of a MenuItem, the submenu must be a Menu object. modifiers: "ctrl-alt", click: function() { // Emitted when user activates the menu item. console.log('clicked!'); -
Julien Le Coupanec revised this gist
Jul 11, 2014 . 1 changed file with 10 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -124,17 +124,17 @@ menu.createMacBuiltin(appname); // OSX only. Create the default menus (App, // MenuItem is usually used with Menu together. var menuItem = new gui.MenuItem({ // Create new MenuItem. type: "normal", // Can also be "separator", "checkbox". A MenuItem's type can be set only when you create it, it cannot be changed at runtime. label: "I'm a menu item", // Label of the MenuItem. It can only be plain text for now. icon: "img/icon.png" // Icon of the MenuItem. It can be a relative path which points to an icon in your app, or an absolute path pointing to a file in user's system. tooltip: "Hey!" // Tooltip of the MenuItem. A tooltip is short string that describes the menu item, it will show when you hover your mouse on the item. checked: false, // Whether the MenuItem is checked. Usually if a MenuItem is checked, there will be a mark on the left side of it. It's used mostly to indicate whether an option is on. enabled: true, // Whether the MenuItem is enabled. An disabled MenuItem will be greyed out and you will not be able to click on it. key: "s", // A single character string to specify the shortcut key for the menu item. submenu: null, // Submenu of a MenuItem, the submenu must be a Menu object. modifiers: "ctrl-alt", click: function() { // Emitted when user activates the menu item. console.log('clicked!'); }, }); -
Julien Le Coupanec revised this gist
Jul 11, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -217,3 +217,4 @@ tray.on('click', function() { }); // Emitted when user clicks the menu item wit gui.Shell.openExternal(URI); // Open the given external protocol URI in the desktop's default manner. (For example, mailto: URLs in the default mail user agent.) gui.Shell.openItem(file_path); // Open the given file_path in the desktop's default manner. gui.Shell.showItemInFolder(file_path); // Show the given file_path in a file manager. If possible, select the file. -
Julien Le Coupanec revised this gist
Jul 11, 2014 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -210,3 +210,10 @@ tray.remove(); // Remove the tray. Once removed, you will not be able to show i tray.on('click', function() { }); // Emitted when user clicks the menu item with left mouse button. // 1.7. Shell. // https://github.com/rogerwang/node-webkit/wiki/Shell gui.Shell.openExternal(URI); // Open the given external protocol URI in the desktop's default manner. (For example, mailto: URLs in the default mail user agent.) gui.Shell.openItem(file_path); // Open the given file_path in the desktop's default manner. gui.Shell.showItemInFolder(file_path); // Show the given file_path in a file manager. If possible, select the file. -
Julien Le Coupanec revised this gist
Jul 11, 2014 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -181,8 +181,7 @@ gui.App.on('reopen', function() { }); // This is a Mac specific feature. This e // https://github.com/rogerwang/node-webkit/wiki/Clipboard var clipboard = gui.Clipboard.get(); // We can not create a clipboard, we have to receive the system clipboard clipboard.set('I love node!', 'text'); // Write data to the clipboard. type specifies the mime type of the data, only text (plain text data) is supported now. clipboard.get([type]); // Returns the data of type from clipboard. Only text (plain text data) is supported now. -
Julien Le Coupanec revised this gist
Jul 11, 2014 . 1 changed file with 14 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -124,7 +124,7 @@ menu.createMacBuiltin(appname); // OSX only. Create the default menus (App, // MenuItem is usually used with Menu together. var menuItem = new gui.MenuItem({ type: "normal", // Can also be "separator", "checkbox". A MenuItem's type can be set only when you create it, it cannot be changed at runtime. label: "I'm a menu item", // Label of the MenuItem. It can only be plain text for now. icon: "img/icon.png" // Icon of the MenuItem. It can be a relative path which points to an icon in your app, or an absolute path pointing to a file in user's system. @@ -139,6 +139,19 @@ new gui.MenuItem({ }, }); menuItem.type; // Get the type of a MenuItem, it can be separator, checkbox and normal for now. A MenuItem's type can be set only when you create it, it cannot be changed at runtime. menuItem.label; // Get or Set the label of a MenuItem, it can only be plain text for now. menuItem.icon; // Get or Set the icon of a MenuItem, it must a path to your icon file. It can be a relative path which points to an icon in your app, or an absolute path pointing to a file in user's system. menuItem.tooltip; // Get or Set the tooltip of a MenuItem, it can only be plain text. A tooltip is short string that describes the menu item, it will show when you hover your mouse on the item. menuItem.checked; // Get or Set whether the MenuItem is checked. Usually if a MenuItem is checked, there will be a mark on the left side of it. It's used mostly to indicate whether an option is on. menuItem.enabled; // Get or Set whether the MenuItem is enabled. An disabled MenuItem will be greyed out and you will not be able to click on it. menuItem.submenu; // Get or Set the submenu of a MenuItem, the submenu must be a Menu object. Developers had better set submenu in the option when creating the MenuItem, changing it at runtime is slow on some platforms. menuItem.click; // Get or Set the click callback of a MenuItem, the click must be a valid function, it will be called when users activate the item. menuItem.key; // A single character string to specify the shortcut key for the menu item. menuItem.modifiers; // A string to specify the modifier keys for the shortcut of the menu item. e.g. "cmd-shift". It should be the concatenation of the following strings: cmd, shift, ctrl, alt. menuItem.on('click', function() { }); // Emitted when user activates the menu item. // 1.4. App. // https://github.com/rogerwang/node-webkit/wiki/App -
Julien Le Coupanec revised this gist
Jul 11, 2014 . 1 changed file with 22 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -176,3 +176,25 @@ clipboard.get([type]); // Returns the data of type from clipboa clipboard.clear(); // Clear the clipboard. // 1.6. Tray. // https://github.com/rogerwang/node-webkit/wiki/Tray var tray = new gui.Tray({ // Create a new Tray, option is an object contains initial settings for the Tray. title: 'Tray', // On Mac title will be showed on status bar along with its icon, but it doesn't have effects on GTK and Windows, since the latter two platforms only support tray to be showed as icons. tooltip: 'Hey!', // Get or Set the tooltip of Tray. tooltip shows when you hover the Tray with mouse. Tooltip is showed on all three platforms. icon: 'img/icon.png', // Get or Set the icon of Tray, icon must a path to your icon file. It can be a relative path which points to an icon in your app, or an absolute path pointing to a file in user's system. menu: null, // Get or Set the menu of Tray, menu will be showed when you click on the Tray icon. }); tray.title; // Get or Set the title of Tray. tray.tooltip; // Get or Set the tooltip of Tray. tooltip shows when you hover the Tray with mouse. tray.icon; // Get or Set the icon of Tray, icon must a path to your icon file. It can be a relative path which points to an icon in your app, or an absolute path pointing to a file in user's system. tray.alticon; // Get or Set the alternate (active) tray icon for Mac. It has no effects on Linux and Win. tray.menu; // Get or Set the menu of Tray, menu will be showed when you click on the Tray icon. tray.remove(); // Remove the tray. Once removed, you will not be able to show it again and you should set your tray variable to null. There is no way temporarily hide a tray icon. tray.on('click', function() { }); // Emitted when user clicks the menu item with left mouse button. -
Julien Le Coupanec revised this gist
Jul 11, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -173,6 +173,6 @@ var clipboard = gui.Clipboard.get(); clipboard.set('I love node!', 'text'); // Write data to the clipboard. type specifies the mime type of the data, only text (plain text data) is supported now. clipboard.get([type]); // Returns the data of type from clipboard. Only text (plain text data) is supported now. clipboard.clear(); // Clear the clipboard. -
Julien Le Coupanec revised this gist
Jul 11, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -164,7 +164,7 @@ gui.App.on('open', function() { }); // Emitted when users opened a file with gui.App.on('reopen', function() { }); // This is a Mac specific feature. This event is sent when the user clicks the dock icon for an already running application. // 1.5. Clipboard. // https://github.com/rogerwang/node-webkit/wiki/Clipboard -
Julien Le Coupanec revised this gist
Jul 11, 2014 . 1 changed file with 15 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -161,4 +161,18 @@ gui.App.addOriginAccessWhitelistEntry(sourceOrigin, destinationProtocol, destina gui.App.removeOriginAccessWhitelistEntry(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains); // Remove an entry from the whitelist used for controlling cross-origin access. See addOriginAccessWhitelistEntry above. gui.App.on('open', function() { }); // Emitted when users opened a file with your app. There is a single parameter of this event callback: Since v0.7.0, it is the full command line of the program; before that it's the argument in the command line and the event is sent multiple times for each of the arguments. gui.App.on('reopen', function() { }); // This is a Mac specific feature. This event is sent when the user clicks the dock icon for an already running application. // 1.5. App. // https://github.com/rogerwang/node-webkit/wiki/Clipboard // We can not create a clipboard, we have to receive the system clipboard var clipboard = gui.Clipboard.get(); clipboard.set('I love node!', 'text'); // Write data to the clipboard. type specifies the mime type of the data, only text (plain text data) is supported now. clipboard.get([type]); // Returns the data of type from clipboard. Only text (plain text data) is supported now. clipboard.clear(); // Clear the clipboard.
NewerOlder