This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.3 KiB
53 lines
1.3 KiB
// shim for using process in browser |
|
|
|
var process = module.exports = {}; |
|
|
|
process.nextTick = (function () { |
|
var canSetImmediate = typeof window !== 'undefined' |
|
&& window.setImmediate; |
|
var canPost = typeof window !== 'undefined' |
|
&& window.postMessage && window.addEventListener |
|
; |
|
|
|
if (canSetImmediate) { |
|
return function (f) { return window.setImmediate(f) }; |
|
} |
|
|
|
if (canPost) { |
|
var queue = []; |
|
window.addEventListener('message', function (ev) { |
|
var source = ev.source; |
|
if ((source === window || source === null) && ev.data === 'process-tick') { |
|
ev.stopPropagation(); |
|
if (queue.length > 0) { |
|
var fn = queue.shift(); |
|
fn(); |
|
} |
|
} |
|
}, true); |
|
|
|
return function nextTick(fn) { |
|
queue.push(fn); |
|
window.postMessage('process-tick', '*'); |
|
}; |
|
} |
|
|
|
return function nextTick(fn) { |
|
setTimeout(fn, 0); |
|
}; |
|
})(); |
|
|
|
process.title = 'browser'; |
|
process.browser = true; |
|
process.env = {}; |
|
process.argv = []; |
|
|
|
process.binding = function (name) { |
|
throw new Error('process.binding is not supported'); |
|
} |
|
|
|
// TODO(shtylman) |
|
process.cwd = function () { return '/' }; |
|
process.chdir = function (dir) { |
|
throw new Error('process.chdir is not supported'); |
|
};
|
|
|