bigpipe-util 0.2.6 → 0.2.7

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/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to `bigpipe-util` will be documented in this file.
4
4
 
5
5
  Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
6
6
 
7
+ ## v0.2.7 - 2025-03-22
8
+
9
+ ### Added
10
+ - Added `timeout` to open dialog with a delay
11
+
7
12
  ## v0.2.6 - 2025-01-16
8
13
 
9
14
  ### Added
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bigpipe-util",
3
3
  "description": "This library currently implements small part of Facebook BigPipe so far, but the advantage is to efficiently insert/replace content and work with the DOM. It is also possible to easily call JavaScript modules from PHP.",
4
- "version": "0.2.6",
4
+ "version": "0.2.7",
5
5
  "keywords": [
6
6
  "bigpipe",
7
7
  "xhr",
@@ -42,18 +42,26 @@ export default class Dialog {
42
42
 
43
43
  dialogId++;
44
44
 
45
- const dialog = this._show({
46
- el: document.getElementById(this.id),
47
- animate: options.animate !== null && options.animate !== undefined ? options.animate : false,
48
- keyboard: options.keyboard !== null && options.keyboard !== undefined ? options.keyboard : true,
49
- backdrop: options.backdrop !== null && options.backdrop !== undefined ? options.backdrop : true,
50
- transition: options.transition !== null && options.transition !== undefined ? options.transition : 0,
51
- backdropTransition: options.backdropTransition !== null && options.backdropTransition !== undefined ? options.backdropTransition : 0,
52
- }, options.controller, args);
53
-
54
- stack.push(dialog);
45
+ const renderDialog = () => {
46
+ const dialog = this._show({
47
+ el: document.getElementById(this.id),
48
+ animate: options.animate !== null && options.animate !== undefined ? options.animate : false,
49
+ keyboard: options.keyboard !== null && options.keyboard !== undefined ? options.keyboard : true,
50
+ backdrop: options.backdrop !== null && options.backdrop !== undefined ? options.backdrop : true,
51
+ transition: options.transition !== null && options.transition !== undefined ? options.transition : 0,
52
+ backdropTransition: options.backdropTransition !== null && options.backdropTransition !== undefined ? options.backdropTransition : 0,
53
+ }, options.controller, args);
54
+
55
+ stack.push(dialog);
56
+
57
+ return dialog;
58
+ };
59
+
60
+ if (options.timeout && typeof options.timeout === 'number') {
61
+ return new Promise(resolve => setTimeout(() => resolve(renderDialog()), options.timeout));
62
+ }
55
63
 
56
- return dialog;
64
+ return renderDialog();
57
65
  }
58
66
 
59
67
  showFromModel(model, args) {