bigpipe-util 0.1.3 → 0.1.4

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
@@ -21,3 +21,12 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
21
21
 
22
22
  ### Fixed
23
23
  - Dialog z-index
24
+
25
+ ## v0.1.4 - 2022-05-06
26
+
27
+ ### Added
28
+ - Async requests counter
29
+ - Support for extra arguments in dialog controller
30
+
31
+ ### Fixed
32
+ - Arguments for non-method require calls
package/README.md CHANGED
@@ -106,10 +106,6 @@ if (OH_NOES_WE_NEED_TO_CANCEL_RIGHT_NOW_OR_ELSE) {
106
106
  rel="dialog">Open Modal</a>
107
107
  ```
108
108
 
109
- ## Credits
110
-
111
- - [Richard Dobroň][link-author]
112
-
113
109
  ## Inspiration
114
110
 
115
111
  BigPipe is inspired by the concept behind Facebook's BigPipe. For more details
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.1.3",
4
+ "version": "0.1.4",
5
5
  "keywords": [
6
6
  "bigpipe",
7
7
  "xhr",
package/src/ServerJS.js CHANGED
@@ -29,8 +29,6 @@ export default class ServerJS {
29
29
 
30
30
  context[method].apply(context, marker || []);
31
31
  } else {
32
- marker = method;
33
-
34
32
  if (marker) {
35
33
  replaceTransportMarkers(this._relativeTo, marker);
36
34
  }
@@ -1,6 +1,8 @@
1
1
  import emptyFunction from "fbjs/lib/emptyFunction";
2
2
  import AsyncResponse from "./AsyncResponse";
3
3
 
4
+ let requests = 0;
5
+
4
6
  function serialize(obj, prefix) {
5
7
  const str = [];
6
8
  for(const p in obj) {
@@ -152,7 +154,13 @@ AsyncRequest.prototype.send = function () {
152
154
  };
153
155
 
154
156
  request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
155
- if (!(this.data instanceof FormData)) {
157
+
158
+ requests++;
159
+
160
+ if (this.data instanceof FormData) {
161
+ this.data.append('__req', requests);
162
+ } else {
163
+ data.__req = requests;
156
164
  data = serialize(data);
157
165
 
158
166
  if (method === "POST") {
@@ -21,7 +21,7 @@ export default class Dialog {
21
21
  }
22
22
  }
23
23
 
24
- render(options) {
24
+ render(options, args) {
25
25
  DOM.appendContent(document.body, this._makeDialog(options.content));
26
26
 
27
27
  modalId++;
@@ -32,12 +32,12 @@ export default class Dialog {
32
32
  backdrop: options.backdrop ?? true,
33
33
  transition: options.transition ?? 0,
34
34
  backdropTransition: options.backdropTransition ?? 0,
35
- }, options.controller);
35
+ }, options.controller, args);
36
36
 
37
37
  stack.push(_dialog);
38
38
  }
39
39
 
40
- showFromModel(model) {
40
+ showFromModel(model, args) {
41
41
  const _dialog = this._show({
42
42
  title: model.title || '',
43
43
  content: model.body,
@@ -46,12 +46,12 @@ export default class Dialog {
46
46
  backdrop: model.backdrop ?? true,
47
47
  transition: model.transition ?? 0,
48
48
  backdropTransition: model.backdropTransition ?? 0,
49
- }, model.controller);
49
+ }, model.controller, args);
50
50
 
51
51
  stack.push(_dialog);
52
52
  }
53
53
 
54
- _show(options, controller) {
54
+ _show(options, controller, args) {
55
55
  if (originalBodyPad === null) {
56
56
  originalBodyPad = document.body.style.paddingRight;
57
57
  }
@@ -59,7 +59,7 @@ export default class Dialog {
59
59
  const _modal = new Modal(options);
60
60
 
61
61
  if (controller) {
62
- (new (window.require(controller))(_modal));
62
+ (new (window.require(controller))(_modal, ...args));
63
63
  }
64
64
 
65
65
  const self = this;