How does node-main block index.html loading in NW.js

Original link: https://www.liesauer.net/blog/post/how-to-block-index-html-loading-with-node-main-in-nw-js.html

In the actual [NW.js](https://ift.tt/u0XKFmN “NW.js”) program development, we may do some pre-loading logic when the program starts, such as updates, etc., so how to wait for these What about loading `index.html` after the logic is completed?

## bootstrap.html

Prepare an App startup page `bootstrap.html`, and point the `main` entry in `package.json` to `bootstrap.html` and no longer point to `index.html`

“`html

starting

starting…

“`

## bootstrap.js

The `node-main` entry in `package.json` points to `bootstrap.js`, which is the startup logic executed in the Node context. After the logic is completed, we can actively jump to `index.html`.

“`js

// Start logic

const main = nw.Window.get();

main.window.location.href=’/index.html’;

“`

In this way we can “block” the loading of `index.html`.

This article is reproduced from: https://www.liesauer.net/blog/post/how-to-block-index-html-loading-with-node-main-in-nw-js.html
This site is only for collection, and the copyright belongs to the original author.