NWJS configuration file Package.json reprint

Source: Internet
Author: User

Configuration file Package.json

NW When starting the application, first to read the Package.json file, initialize the basic properties, let us look at the full parameters of Package.json. Each parameter configuration is marked with a comment.

[Plain]View PlainCopy 
  1. {
  2. /** Specifies the start page of the program. */
  3. "Main": "Index.html",
  4. The/** string must be a lowercase letter or a number that can contain. Or _ or-no spaces are allowed. Name must be globally unique. */
  5. "Name": "Demo",
  6. /** Program Description */
  7. "description": "Demo app of Node-webkit",
  8. /** Program Version number */
  9. "Version": "0.1.0",
  10. /** keywords */
  11. "keywords": ["Demo", "Node-webkit"],
  12. The/**bool value, if set to False, disables the WebKit node support. */
  13. "Nodejs": true,
  14. /**
  15. * Specify a node. js file that will be run when the program starts, and the boot time is earlier than Node-webkit loading HTML.
  16. * It runs in the node context and can be used to implement functions like a background thread.
  17. * (no need to annotate)
  18. */
  19. "Node-main": "Js/node.js",
  20. /**
  21. * BOOL value. By default, if you package a Node-webkit program for publishing, you can only start an instance of the app.
  22. * Set this value to False if you want to allow multiple instances to be started at the same time.
  23. */
  24. "Single-instance": true,
  25. /** Window Property Settings */
  26. "Window": {
  27. /** string, sets the default title. */
  28. "Title": "Demo",
  29. Icon for the/** window. */
  30. "Icon": "Link.png",
  31. The/**bool value. Whether to display the navigation bar. */
  32. "Toolbar": false,
  33. The/**bool value. Whether to allow resizing of the window. */
  34. "Resizable": true,
  35. /** is full screen */
  36. "fullscreen": false,
  37. /** If the icon is displayed in the WIN task bar */
  38. "Show_in_taskbar": true,
  39. The/**bool value. If set to False, the program will display without Borders. */
  40. "Frame": true,
  41. The/** string. The position of the window when it is opened can be set to "null", "center", or "mouse". */
  42. "Position": "Center",
  43. /** the width of the main window. */
  44. "width": 800,
  45. /** the height of the main window. */
  46. "Height": 670,
  47. The minimum width of the/** window. */
  48. "Min_width": 400,
  49. The minimum height of the/** window. */
  50. "Min_height": 335,
  51. The/** window displays the maximum width, which is not set. */
  52. "Max_width": 800,
  53. /** the maximum height displayed by the window is not set. */
  54. "Max_height": 670,
  55. The/**bool value, if set to false, when the window is not visible at startup. */
  56. "Show": true,
  57. /** whether the icon is displayed on the taskbar. */
  58. "Show_in_taskbar": true,
  59. /**
  60. * BOOL value. Whether to use Kiosk mode. If kiosk mode is used,
  61. * The app will display full screen and prevent users from leaving the app.
  62. * */
  63. "Kiosk": false
  64. },
  65. /**webkit Settings */
  66. "WebKit": {
  67. /**bool value, whether the plug-in is loaded, such as Flash, the default value is False. */
  68. "Plugin": true,
  69. /**bool value, whether Java applets is loaded, default is False. */
  70. "Java": false,
  71. /**bool value, whether page caching is enabled, false by default. */
  72. "Page-cache": false
  73. }
  74. }

In the above configuration, main and name are required properties. Other simple and straightforward to read the comments directly, Bo main talk about a few more difficult to understand the parameters configuration.

(1) "Node-main" configuration: Specify a JS file, the JS file is the first to run the program when the file, in the Node-main script can also access the global "Window" object, which points to the Dom window, but if the page navigation has changed, The Window object accessed is also changed. Because it executes before the DOM is loaded, the "window" object cannot be used until the page has finished loading. Also, in the DOM page, you can get node-main information through Process.mainmodule.

(2) "single-instance" configuration: Simply speaking, whether to allow multiple NW applications to be opened at the same time.

(3) "Kiosk" configuration: If the configuration is set to Ture, it is displayed in full screen mode and the block off button, that is, the display will remain in the NW application display interface, similar to the bank queue waiting for business of the ticket machine interface.

NWJS configuration file Package.json reprint

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.