mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-25 14:59:16 +01:00
28 lines
547 B
JavaScript
Vendored
28 lines
547 B
JavaScript
Vendored
require('@babel/register')();
|
|
|
|
var canvas = require('canvas');
|
|
|
|
const jsdom = require('jsdom');
|
|
|
|
const { window } = new jsdom.JSDOM(`<!DOCTYPE html>`, { url: 'https://localhost' });
|
|
|
|
const canvasMethods = [
|
|
'HTMLCanvasElement',
|
|
];
|
|
|
|
Object.keys(window).forEach(property => {
|
|
if (typeof global[property] === 'undefined') {
|
|
global[property] = window[property];
|
|
}
|
|
});
|
|
|
|
canvasMethods.forEach(method =>
|
|
global[method] = window[method]
|
|
);
|
|
|
|
global['CanvasRenderingContext2D'] = canvas.Context2d;
|
|
|
|
global.navigator = {
|
|
userAgent: 'node.js'
|
|
};
|