open-stage-control/scripts/client-shim.js
2024-07-26 12:41:27 +02:00

88 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Dirty browser window shim
document = {
createElement: x=>({
ownerDocument: document,
style: {},
contentWindow: {},
nodeName: '',
childNodes: [],
setAttribute: ()=>{},
appendChild: ()=>{},
lastChild: {},
toString: ()=>' ',
removeChild: ()=>{},
contentWindow: {
document: {
open: ()=>{},
close: ()=>{},
write: ()=>{},
}
}
}),
createTextNode: x=>({
nodeValue: '',
nodeName: '',
childNodes: [],
setAttribute: ()=>{},
appendChild: ()=>{},
lastChild: {},
toString: ()=>' '
}),
createElementNS: x=>[],
addEventListener: ()=>{},
createRange: ()=>{
return {
createContextualFragment:()=>{return {
firstChild: {
querySelectorAll: x=>[]
}
}},
selectNode: ()=>{}
}
},
body: {
appendChild: ()=>{},
addEventListener: ()=>{}
},
location: {},
documentElement: {
appendChild: ()=>{},
removeChild: ()=>{}
}
}
window = {
screen: {width: 800, height: 600},
addEventListener: ()=>{},
location: {},
Image: Function,
document: document,
navigator: {
platform:'',
userAgent: ''
},
NodeList: Array,
WebSocket: Object,
localStorage: {
getItem(){return null}
},
sessionStorage: {
getItem(){return null},
setItem(){},
},
MutationObserver: class MutationObserver{}
}
Object.assign(global, window)
// Required globals
DOM = require('../src/client/dom')
DOM.get = x=>[{addEventListener:()=>{}, style:{}}]
DOM.init()
ELECTRON_NOGPU = false
CANVAS_FRAMERATE = 1
LANG = 'en'
ENV = {id: ''}
IP = ''