summaryrefslogtreecommitdiff
path: root/packages/integrations/lit/server-shim.js
blob: 873d3cd8278e0c39e136e750c9426dc5011b062d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { installWindowOnGlobal } from '@lit-labs/ssr/lib/dom-shim.js';

if(typeof fetch === 'function') {
	const _fetch = fetch;
	installWindowOnGlobal();
	globalThis.fetch = window.fetch = _fetch;
} else {
	installWindowOnGlobal();
}

window.global = window;
document.getElementsByTagName = () => [];
// See https://github.com/lit/lit/issues/2393
document.currentScript = null;

const ceDefine = customElements.define;
customElements.define = function (tagName, Ctr) {
	Ctr[Symbol.for('tagName')] = tagName;
	return ceDefine.call(this, tagName, Ctr);
};