forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__webpack_process.js
More file actions
54 lines (52 loc) · 1.43 KB
/
__webpack_process.js
File metadata and controls
54 lines (52 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
exports = module.exports = new (require("events").EventEmitter);
if(Object.prototype.__defineGetter__) {
exports.__defineGetter__("title", function() { return window.title; });
exports.__defineSetter__("title", function(t) { window.title = t; });
} else {
exports.title = window.title;
}
exports.version = exports.arch =
exports.execPath = "webpack";
exports.platform = "browser";
// TODO stdin, stdout, stderr
exports.argv = ["webpack", "browser"];
exports.pid = 1;
exports.nextTick = (function(func) {
// from https://github.com/substack/node-browserify/blob/master/wrappers/process.js
var queue = [];
var canPost = typeof window !== 'undefined'
&& window.postMessage && window.addEventListener
;
if (canPost) {
window.addEventListener('message', function (ev) {
if (ev.source === window && ev.data === 'webpack-tick') {
ev.stopPropagation();
if (queue.length > 0) {
var fn = queue.shift();
fn();
}
}
}, true);
}
return function (fn) {
if (canPost) {
queue.push(fn);
window.postMessage('webpack-tick', '*');
}
else setTimeout(fn, 0);
};
}());
exports.cwd = function() {
var pathname = (window.location.pathname+"").split("/");
pathname.pop();
return pathname.join("/");
}
exports.exit = exports.kill =
exports.chdir =
exports.umask = exports.dlopen =
exports.uptime = exports.memoryUsage =
exports.uvCounters = function() {};
exports.features = {};
exports.binding = function(str) {
return {};
}