-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.ts
51 lines (43 loc) · 1.13 KB
/
server.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// ssr DOM
import '@ng-web-apis/universal/mocks';
import { join } from 'path';
import 'zone.js/dist/zone-node';
import 'zone.js/dist/zone-patch-rxjs';
const domino = require('domino');
const fs = require('fs');
const path = require('path');
// index from browser build!
export const distFolder = join(
process.cwd(),
'dist',
'kirjs-stream-overlay',
'browser',
);
const template = fs
.readFileSync(path.join(distFolder, 'index.html'))
.toString();
// for mock global window by domino
const win = domino.createWindow(template);
// mock
global['window'] = win;
global['navigator'] = win.navigator;
// (global as any)['requestAnimationFrame'] = function () {};
// win['requestAnimationFrame'] = function () {};
global['cancelAnimationFrame'] = function (id) {
clearTimeout(id);
};
(global as any)['debug'] = () => {};
// not implemented property and functions
Object.defineProperty(win.document.body.style, 'transform', {
value: () => {
return {
enumerable: true,
configurable: true,
};
},
});
// mock documnet
global['document'] = win.document;
// othres mock
global['CSS'] = null as any;
require('extra_server');