New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

electron-url

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-url

A simple way to load a file/url in electron using patterns.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

electron-url

npm npm

A simple way to load a file/url in electron using patterns.

Install

npm install --save electron-url

Usage

//Import dependencies
var electron = require('electron');
var electronUrl = require('electron-url'); 
var path = require('path');

//Import electron modules
var app = electron.app;
var BrowserWindow = electron.BrowserWindow; 

//Initialize the url pattern 
electronUrl.pattern(path.join('file://' + __dirname, './{file}')); 

//Initialize the app 
app.on('ready', function()
{
  //Create the new window
  var mainWindow = new BrowserWindow({ width: 800, height: 600 });

  //More app configuration
  // ....

  //Load the file
  electronUrl.load(mainWindow, { file: 'index.html' });
});

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:

{ "path": "my/path", "file": "test" }

The following url will be generated:

file://my/path/test.html

.pattern(value)

Set the default pattern.

value

A string with the pattern.

  • electron-ejs: use ejs files in electron.

License

MIT LICENSE © Josemi Juanes.

Keywords

FAQs

Package last updated on 15 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc