Skip to content
This repository was archived by the owner on Nov 16, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var open = require('open');
var open = require("open");

/**
* Creates a function that is restricted to invoking func once.
Expand All @@ -14,7 +14,7 @@ function once(fn) {
called = true;
fn.apply(this, arguments);
}
}
};
}

/**
Expand All @@ -28,7 +28,7 @@ function once(fn) {
*/
function OpenBrowserPlugin(options) {
options || (options = {});
this.url = options.url || 'http://localhost:8080';
this.url = options.url || "http://localhost:8080";
this.delay = options.delay || 0;
this.browser = options.browser;
this.ignoreErrors = options.ignoreErrors;
Expand All @@ -41,19 +41,19 @@ OpenBrowserPlugin.prototype.apply = function(compiler) {
var browser = this.browser;
var ignoreErrors = this.ignoreErrors;
var executeOpen = once(function() {
setTimeout(function () {
setTimeout(function() {
open(url, browser, function(err) {
if (err) throw err;
});
}, delay);
})
});

compiler.plugin('watch-run', function checkWatchingMode(watching, done) {
compiler.plugin("watch-run", function checkWatchingMode(watching, done) {
isWatching = true;
done();
});

compiler.plugin('done', function doneCallback(stats) {
compiler.plugin("done", function doneCallback(stats) {
if (isWatching && (!stats.hasErrors() || ignoreErrors)) {
executeOpen();
}
Expand Down
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"homepage": "https://github.com/baldore/webpack-open-plugin#readme",
"dependencies": {
"open": "0.0.5"
"open": "^6.3.0"
},
"devDependencies": {
"webpack": "^1.12.1"
Expand Down