bigpipe-util 0.2.10 → 0.2.11
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 +7 -0
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/Primer.js +6 -1
- package/src/async/AsyncDOM.js +1 -1
- package/src/async/AsyncRequest.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ 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.11 - 2025-12-27
|
|
8
|
+
- Added `incrementRequests` method to AsyncRequest.js
|
|
9
|
+
- Added submitter to form data in onSubmit handler
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Added `timeout` to open dialog with a delay in method `showFromModel`
|
|
13
|
+
|
|
7
14
|
## v0.2.10 - 2025-05-15
|
|
8
15
|
- Added `onAfterLoad.js`, `waitForLoad.js`
|
|
9
16
|
|
package/README.md
CHANGED
|
@@ -42,11 +42,11 @@ window.require = (modulePath) => {
|
|
|
42
42
|
### 4. Add these lines to the page footer:
|
|
43
43
|
```html
|
|
44
44
|
<script>
|
|
45
|
-
(new (require("bigpipe-util/ServerJS"))).handle(<?=json_encode(\dobron\BigPipe\BigPipe::jsmods())?>);
|
|
45
|
+
(new (require("bigpipe-util/src/ServerJS"))).handle(<?=json_encode(\dobron\BigPipe\BigPipe::jsmods())?>);
|
|
46
46
|
</script>
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
## Request API
|
|
49
|
+
## 🛜 Request API
|
|
50
50
|
|
|
51
51
|
```javascript
|
|
52
52
|
import AsyncRequest from 'bigpipe-util/src/AsyncRequest';
|
|
@@ -119,6 +119,6 @@ We welcome contributions! If you'd like to help improve this project, feel free
|
|
|
119
119
|
|
|
120
120
|
## 📜 License
|
|
121
121
|
|
|
122
|
-
The MIT License (MIT). Please see [License File](LICENSE
|
|
122
|
+
The MIT License (MIT). Please see [License File](LICENSE) for more information.
|
|
123
123
|
|
|
124
124
|
[blog]: https://www.facebook.com/notes/facebook-engineering/bigpipe-pipelining-web-pages-for-high-performance/389414033919
|
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.
|
|
4
|
+
"version": "0.2.11",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bigpipe",
|
|
7
7
|
"xhr",
|
package/src/Primer.js
CHANGED
|
@@ -83,13 +83,18 @@ export default function Primer() {
|
|
|
83
83
|
eventTarget.getAttribute("rel") === "async") {
|
|
84
84
|
event.preventDefault();
|
|
85
85
|
|
|
86
|
+
const formData = new FormData(eventTarget);
|
|
86
87
|
const submitter = event.submitter || eventTarget.querySelector("button[type='submit']");
|
|
87
88
|
const activeControls = eventTarget.querySelectorAll("input:not([readonly]),select:not([readonly]),textarea:not([readonly])");
|
|
88
89
|
|
|
90
|
+
if (submitter.name) {
|
|
91
|
+
formData.append(submitter.name, submitter.value);
|
|
92
|
+
}
|
|
93
|
+
|
|
89
94
|
(new AsyncRequest(eventTarget.getAttribute("ajaxify") || eventTarget.getAttribute("action")))
|
|
90
95
|
.setMethod(eventTarget.method || "POST")
|
|
91
96
|
.setRelative(eventTarget)
|
|
92
|
-
.setData(
|
|
97
|
+
.setData(formData)
|
|
93
98
|
.setInitialHandler(function () {
|
|
94
99
|
eventTarget.classList.add("async-saving");
|
|
95
100
|
|
package/src/async/AsyncDOM.js
CHANGED
|
@@ -3,6 +3,10 @@ import AsyncResponse from "./AsyncResponse";
|
|
|
3
3
|
|
|
4
4
|
let requests = 0;
|
|
5
5
|
|
|
6
|
+
export function incrementRequests() {
|
|
7
|
+
return requests++;
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
function serialize(obj, prefix) {
|
|
7
11
|
const str = [];
|
|
8
12
|
for(const p in obj) {
|
|
@@ -181,7 +185,7 @@ export default class AsyncRequest {
|
|
|
181
185
|
|
|
182
186
|
request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
|
183
187
|
|
|
184
|
-
|
|
188
|
+
incrementRequests();
|
|
185
189
|
|
|
186
190
|
if (data instanceof FormData) {
|
|
187
191
|
data.append('__req', requests);
|