Code Monkey home page Code Monkey logo

nw-splasher's Introduction

NW-Splasher

Small library to show a splash screen until main application loads.

The splash screen will run in a separate process so any animations will play smoothly while the app is loading.


Demo

Here is a demo project that uses the nw-splasher.js and nw-splasher.css files:


Usage

  1. npm install --save nw-splasher
  2. Create a splash.html file and an index.html file (for your app)
    • Add this line to the <head> of both files.
    • <script src="node_modules/nw-splasher/nw-splasher.js"></script>
  3. In package.json set "main": "splash.html"
  4. In the splash.html run nwSplasher.loadAppWindowInBackground()
  5. In the index.html run nwSplasher.closeSplashAndShowApp() after the app is done loading and ready to be displayed

API

nwSplasher.loadAppWindowInBackground(url, newWindowOptions, port)

Used by your Splash screen window. This creates a websocket and spawns your main app in a hidden window. Then waits for the app to send a signal to the websocket to close the splash screen.

Argument Optional Type Description Defaults
url yes String URL to load in the App window. Defaults to index.html, default.html, main.html, or app.html if those files exist, or the first html file it finds in the current directory. Console logs if no html file found.
newWindowOptions yes Object Object with the NW.js Window Subfields. show is always set to false. new_instance is always set to true.
port yes Number If you pass in a number it must match the same port number passed in the app window. Defaults to 4443.

nwSplasher.closeSplashAndShowApp(port)

Call this from your App window when it is ready to be shown. This will also trigger closing the Splash screen window.

Argument Optional Type Description Defaults
port yes Number If you pass in a number it must match the same port number passed in the splash window. Defaults to 4443.

nw-splasher's People

Contributors

thejaredwilcurt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.