electron-url
A simple way to load a file/url in electron using patterns.
Install
npm install --save electron-url
Usage
//Import dependenciesvar electron = ;var electronUrl = ; var path = ; //Import electron modulesvar app = electronapp;var BrowserWindow = electronBrowserWindow; //Initialize the url pattern electronUrl; //Initialize the app app;
API
.load(window, replace)
Load a file or an url on the window
.
window
A BrowserWindow
object where you want to load the url or file. Read the electron documentation for more info.
replace
An object where each key will be replaced on the url pattern with the value provided.
For example, on the following url pattern:
file://{path}/{file}.html
If you provide the following replace object:
The following url will be generated:
file://my/path/test.html
.pattern(value)
Set the default pattern.
value
A string with the pattern.
Related
- electron-ejs: use ejs files in electron.
License
MIT LICENSE © Josemi Juanes.