0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/integrations/lit/server-shim.js

21 lines
556 B
JavaScript
Raw Normal View History

import { installWindowOnGlobal } from '@lit-labs/ssr/lib/dom-shim.js';
2023-01-09 17:01:33 -05:00
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;
2022-06-21 07:33:55 -05:00
customElements.define = function (tagName, Ctr) {
Ctr[Symbol.for('tagName')] = tagName;
return ceDefine.call(this, tagName, Ctr);
2022-06-21 07:33:55 -05:00
};