open-stage-control/scripts/client-shim.js
2019-04-02 10:17:33 +02:00

59 lines
1.2 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=>({
nodeName: '',
childNodes: [],
setAttribute: ()=>{},
appendChild: ()=>{},
lastChild: {},
toString: ()=>' ',
removeChild: ()=>{}
}),
createTextNode: x=>({
nodeValue: '',
nodeName: '',
childNodes: [],
setAttribute: ()=>{},
appendChild: ()=>{},
lastChild: {},
toString: ()=>' '
}),
createElementNS: x=>[],
addEventListener: ()=>{},
createRange: ()=>{
return {
createContextualFragment:()=>{return {
firstChild: {
querySelectorAll: x=>[]
}
}},
selectNode: ()=>{}
}
},
body: {
appendChild: ()=>{},
addEventListener: ()=>{}
}
}
window = {
addEventListener: ()=>{},
location: {},
document: document,
navigator: {
platform:''
},
NodeList: Array,
WebSocket: Object
}
Object.assign(global, window)
// Required globals
DOM = require('../src/client/app/dom')
DOM.get = x=>[{addEventListener:()=>{}}]
DOM.init()
CANVAS_FRAMERATE = 1
LANG = 'en'