mirror of https://github.com/sveltejs/svelte
parent
2ac5993571
commit
f60ae53d76
@ -1,5 +1,41 @@
|
|||||||
import { is_client } from './utils';
|
const {
|
||||||
|
// ecmascript
|
||||||
|
Error,
|
||||||
|
JSON,
|
||||||
|
Map,
|
||||||
|
Object,
|
||||||
|
console,
|
||||||
|
isNaN,
|
||||||
|
|
||||||
const { console, Error, Map, Object } = (is_client ? window : global) as { console, Error, Map, Object };
|
// dom
|
||||||
|
cancelAnimationFrame,
|
||||||
|
clearTimeout,
|
||||||
|
customElements,
|
||||||
|
document,
|
||||||
|
getComputedStyle,
|
||||||
|
navigator,
|
||||||
|
requestAnimationFrame,
|
||||||
|
setTimeout: export_setTimeout, // TODO: remove when upgrading typescript, bug
|
||||||
|
window: export_window,
|
||||||
|
} = (window || global) as unknown as typeof globalThis;
|
||||||
|
|
||||||
export { console, Error, Map, Object };
|
export {
|
||||||
|
// ecmascript
|
||||||
|
Error,
|
||||||
|
JSON,
|
||||||
|
Map,
|
||||||
|
Object,
|
||||||
|
console,
|
||||||
|
isNaN,
|
||||||
|
|
||||||
|
// dom
|
||||||
|
cancelAnimationFrame,
|
||||||
|
clearTimeout,
|
||||||
|
customElements,
|
||||||
|
document,
|
||||||
|
getComputedStyle,
|
||||||
|
navigator,
|
||||||
|
requestAnimationFrame,
|
||||||
|
export_setTimeout as setTimeout,
|
||||||
|
export_window as window,
|
||||||
|
};
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
export default {
|
||||||
|
preserveIdentifiers: true,
|
||||||
|
compileOptions: {
|
||||||
|
name: 'window'
|
||||||
|
},
|
||||||
|
|
||||||
|
html: `
|
||||||
|
<p>I hereby declare Svelte the bestest framework.</p>
|
||||||
|
<p>nintendo sixty four</p>
|
||||||
|
<p>Woops.</p>
|
||||||
|
<p>42</p>
|
||||||
|
<p>false</p>
|
||||||
|
`
|
||||||
|
};
|
@ -0,0 +1,20 @@
|
|||||||
|
<script>
|
||||||
|
const document = 'I hereby declare Svelte the bestest framework.';
|
||||||
|
const console = 'nintendo sixty four';
|
||||||
|
const Error = 'Woops.';
|
||||||
|
const Object = 42;
|
||||||
|
const Map = false;
|
||||||
|
|
||||||
|
const everyone = [document, console, Error, Object, Map];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>Cute test</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
|
<svelte:window on:click></svelte:window>
|
||||||
|
<svelte:body on:mouseenter></svelte:body>
|
||||||
|
|
||||||
|
{#each everyone as someone (someone)}
|
||||||
|
<p>{someone}</p>
|
||||||
|
{/each}
|
Loading…
Reference in new issue