solid-js 1.8.0-beta.0 → 1.8.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solid-js",
3
3
  "description": "A declarative JavaScript library for building user interfaces.",
4
- "version": "1.8.0-beta.0",
4
+ "version": "1.8.0-beta.1",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -8,7 +8,8 @@ type SharedConfig = {
8
8
  resources?: {
9
9
  [key: string]: any;
10
10
  };
11
- load?: (id: string) => Promise<any> | any | undefined;
11
+ load?: (id: string) => Promise<any> | any;
12
+ has?: (id: string) => boolean;
12
13
  gather?: (key: string) => void;
13
14
  registry?: Map<string, Element>;
14
15
  done?: boolean;
@@ -99,9 +99,8 @@ function renderToStream(code, options = {}) {
99
99
  tasks = getLocalHeaderScript(renderId);
100
100
  }
101
101
  tasks += task + ";";
102
- if (!scheduled && firstFlushed) {
103
- Promise.resolve().then(writeTasks);
104
- scheduled = true;
102
+ if (!timer && firstFlushed) {
103
+ timer = setTimeout(writeTasks);
105
104
  }
106
105
  };
107
106
  const checkEnd = () => {
@@ -133,7 +132,8 @@ function renderToStream(code, options = {}) {
133
132
  buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>${tasks}</script>`);
134
133
  tasks = "";
135
134
  }
136
- scheduled = false;
135
+ timer && clearTimeout(timer);
136
+ timer = null;
137
137
  };
138
138
  let context;
139
139
  let writable;
@@ -142,7 +142,7 @@ function renderToStream(code, options = {}) {
142
142
  let firstFlushed = false;
143
143
  let completed = false;
144
144
  let scriptFlushed = false;
145
- let scheduled = true;
145
+ let timer = null;
146
146
  let buffer = {
147
147
  write(payload) {
148
148
  tmp += payload;
@@ -228,7 +228,6 @@ function renderToStream(code, options = {}) {
228
228
  if (tasks.length) html = injectScripts(html, tasks, nonce);
229
229
  buffer.write(html);
230
230
  tasks = "";
231
- scheduled = false;
232
231
  onCompleteShell && onCompleteShell({
233
232
  write(v) {
234
233
  !completed && buffer.write(v);
@@ -125,9 +125,8 @@ function renderToStream(code, options = {}) {
125
125
  tasks = getLocalHeaderScript(renderId);
126
126
  }
127
127
  tasks += task + ";";
128
- if (!scheduled && firstFlushed) {
129
- Promise.resolve().then(writeTasks);
130
- scheduled = true;
128
+ if (!timer && firstFlushed) {
129
+ timer = setTimeout(writeTasks);
131
130
  }
132
131
  };
133
132
  const checkEnd = () => {
@@ -160,7 +159,8 @@ function renderToStream(code, options = {}) {
160
159
  buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>${tasks}</script>`);
161
160
  tasks = "";
162
161
  }
163
- scheduled = false;
162
+ timer && clearTimeout(timer);
163
+ timer = null;
164
164
  };
165
165
  let context;
166
166
  let writable;
@@ -169,7 +169,7 @@ function renderToStream(code, options = {}) {
169
169
  let firstFlushed = false;
170
170
  let completed = false;
171
171
  let scriptFlushed = false;
172
- let scheduled = true;
172
+ let timer = null;
173
173
  let buffer = {
174
174
  write(payload) {
175
175
  tmp += payload;
@@ -260,7 +260,6 @@ function renderToStream(code, options = {}) {
260
260
  if (tasks.length) html = injectScripts(html, tasks, nonce);
261
261
  buffer.write(html);
262
262
  tasks = "";
263
- scheduled = false;
264
263
  onCompleteShell &&
265
264
  onCompleteShell({
266
265
  write(v) {