vaderjs 1.3.3-alpha-38 → 1.3.3-alpha-39

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/runtime/router.js +10 -27
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "vaderjs",
3
3
  "description": "A Reactive library aimed to helping you build reactive applications inspired by react.js",
4
4
  "module": "vader.js",
5
- "version": "1.3.3-alpha-38",
5
+ "version": "1.3.3-alpha-39",
6
6
  "bin": {
7
7
  "vader": "./vader.js"
8
8
  },
package/runtime/router.js CHANGED
@@ -269,40 +269,23 @@ class VaderRouter{
269
269
  // Allow pausing the route and run code before rendering
270
270
  await new Promise(async (resolve) => {
271
271
  await Component.router.use(req, res)
272
- if(!req.pause){
273
- resolve();
274
- }
272
+ if(req.pause){
273
+ let timer = setInterval(() => {
274
+ if(!req.pause){
275
+ resolve();
276
+ clearInterval(timer);
277
+ }
278
+ }, 1000);
279
+ }
275
280
  });
276
281
  } else if (Component.router.use && Component.isChild) {
277
282
  console.warn('Router.use() is not supported in child components');
278
- }
279
-
280
- // Check if the request is not paused
281
- if (!req.pause) {
282
- // Assuming Component.render() is an asynchronous function
283
+ }
283
284
  const renderedContent = await Component.render();
284
285
  document.querySelector('#root').innerHTML = renderedContent;
285
286
  Component.bindMount();
286
287
  Component.onMount();
287
- } else {
288
- console.log(`Request paused for ${req.path}`);
289
-
290
- // Continue rendering after a delay if the request is paused
291
- await new Promise((resolve) => {
292
- let i = setInterval(() => {
293
- if (!req.pause) {
294
- clearInterval(i);
295
- resolve();
296
- }
297
- }, 1000);
298
- });
299
-
300
- // Assuming Component.render() is an asynchronous function
301
- const renderedContent = await Component.render();
302
- document.querySelector('#root').innerHTML = renderedContent;
303
- Component.bindMount();
304
- Component.onMount();
305
- }
288
+
306
289
  } catch (error) {
307
290
  console.error(error);
308
291
  }