script: missing file

This commit is contained in:
bordun 2018-10-29 13:05:38 +01:00
parent 1cfa2018f2
commit b777931b84

58
scripts/client-shim.js Normal file
View file

@ -0,0 +1,58 @@
// 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: ()=>{}
}
}
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'