@php-wasm/progress 0.5.2 → 0.5.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/index.cjs +1 -1
- package/index.js +136 -76
- package/package.json +6 -4
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var P=(
|
|
1
|
+
"use strict";var P=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var l=(r,e,t)=>(P(r,e,"read from private field"),t?t.call(r):e.get(r)),d=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},y=(r,e,t,s)=>(P(r,e,"write to private field"),s?s.call(r,t):e.set(r,t),t);var L=(r,e,t,s)=>({set _(n){y(r,e,n,t)},get _(){return l(r,e,s)}}),u=(r,e,t)=>(P(r,e,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});if(typeof File>"u"){class r extends Blob{constructor(t,s,n){super(t);let i;n!=null&&n.lastModified&&(i=new Date),(!i||isNaN(i.getFullYear()))&&(i=new Date),this.lastModifiedDate=i,this.lastModified=i.getMilliseconds(),this.name=s||""}}global.File=r}function F(r){return new Promise(function(e,t){r.onload=r.onerror=function(s){r.onload=r.onerror=null,s.type==="load"?e(r.result):t(new Error("Failed to read the blob/file"))}})}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const e=new FileReader;return e.readAsArrayBuffer(this),F(e)});typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const e=new FileReader;return e.readAsText(this),F(e)});function D(){const r=new Uint8Array([1,2,3,4]),t=new File([r],"test").stream();try{return t.getReader({mode:"byob"}),t.getReader({mode:"byob"}),!0}catch{return!1}}(typeof Blob.prototype.stream>"u"||!D())&&(Blob.prototype.stream=function(){let r=0;const e=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(t){const s=t.byobRequest.view,i=await e.slice(r,r+s.byteLength).arrayBuffer(),a=new Uint8Array(i);new Uint8Array(s.buffer).set(a);const o=a.byteLength;t.byobRequest.respond(o),r+=o,r>=e.size&&t.close()}})});if(typeof CustomEvent>"u"){class r extends Event{constructor(t,s={}){super(t,s),this.detail=s.detail}initCustomEvent(){}}globalThis.CustomEvent=r}const A=5*1024*1024;var g,p,w,M,E,B,b,v;class k extends EventTarget{constructor(t=[]){super();d(this,w);d(this,E);d(this,b);d(this,g,{});d(this,p,{});this.setModules(t),u(this,w,M).call(this)}getEmscriptenOptions(){return{dataFileDownloads:u(this,E,B).call(this)}}setModules(t){y(this,g,t.reduce((s,n)=>{if(n.dependenciesTotalSize>0){const i="http://example.com/",o=new URL(n.dependencyFilename,i).pathname.split("/").pop();s[o]=Math.max(o in s?s[o]:0,n.dependenciesTotalSize)}return s},{})),y(this,p,Object.fromEntries(Object.entries(l(this,g)).map(([s])=>[s,0])))}}g=new WeakMap,p=new WeakMap,w=new WeakSet,M=function(){const t=WebAssembly.instantiateStreaming;WebAssembly.instantiateStreaming=async(s,...n)=>{const i=await s,a=i.url.substring(new URL(i.url).origin.length+1),o=I(i,({detail:{loaded:h,total:c}})=>u(this,b,v).call(this,a,h,c));return t(o,...n)}},E=new WeakSet,B=function(){const t=this,s={};return new Proxy(s,{set(n,i,a){var o;return u(o=t,b,v).call(o,i,a.loaded,a.total),n[i]=new Proxy(JSON.parse(JSON.stringify(a)),{set(h,c,O){var x;return h[c]=O,u(x=t,b,v).call(x,i,h.loaded,h.total),!0}}),!0}})},b=new WeakSet,v=function(t,s,n){const i=new URL(t,"http://example.com").pathname.split("/").pop();n||(n=l(this,g)[i]),i in l(this,p)||console.warn(`Registered a download #progress of an unregistered file "${i}". This may cause a sudden **decrease** in the #progress percentage as the total number of bytes increases during the download.`),l(this,p)[i]=s,this.dispatchEvent(new CustomEvent("progress",{detail:{loaded:C(l(this,p)),total:C(l(this,g))}}))};function C(r){return Object.values(r).reduce((e,t)=>e+t,0)}function I(r,e){const t=r.headers.get("content-length")||"",s=parseInt(t,10)||A;function n(i,a){e(new CustomEvent("progress",{detail:{loaded:i,total:a}}))}return new Response(new ReadableStream({async start(i){if(!r.body){i.close();return}const a=r.body.getReader();let o=0;for(;;)try{const{done:h,value:c}=await a.read();if(c&&(o+=c.byteLength),h){n(o,o),i.close();break}else n(o,s),i.enqueue(c)}catch(h){console.error({e:h}),i.error(h);break}}}),{status:r.status,statusText:r.statusText,headers:r.headers})}var f,m,_,R;class W extends EventTarget{constructor(){super(...arguments);d(this,_);d(this,f,void 0);d(this,m,void 0);y(this,f,{}),y(this,m,0),this.progress=0,this.mode="REAL_TIME",this.caption=""}partialObserver(t,s=""){const n=++L(this,m)._;return l(this,f)[n]=0,i=>{const{loaded:a,total:o}=(i==null?void 0:i.detail)||{};l(this,f)[n]=a/o*t,u(this,_,R).call(this,this.totalProgress,"REAL_TIME",s)}}slowlyIncrementBy(t){const s=++L(this,m)._;l(this,f)[s]=t,u(this,_,R).call(this,this.totalProgress,"SLOWLY_INCREMENT")}get totalProgress(){return Object.values(l(this,f)).reduce((t,s)=>t+s,0)}}f=new WeakMap,m=new WeakMap,_=new WeakSet,R=function(t,s,n){this.dispatchEvent(new CustomEvent("progress",{detail:{progress:t,mode:s,caption:n}}))};const T=1e-5;class S extends EventTarget{constructor({weight:e=1,caption:t="",fillTime:s=4}={}){super(),this._selfWeight=1,this._selfDone=!1,this._selfProgress=0,this._selfCaption="",this._isFilling=!1,this._subTrackers=[],this._weight=e,this._selfCaption=t,this._fillTime=s}stage(e,t=""){if(e||(e=this._selfWeight),this._selfWeight-e<-T)throw new Error(`Cannot add a stage with weight ${e} as the total weight of registered stages would exceed 1.`);this._selfWeight-=e;const s=new S({caption:t,weight:e,fillTime:this._fillTime});return this._subTrackers.push(s),s.addEventListener("progress",()=>this.notifyProgress()),s.addEventListener("done",()=>{this.done&&this.notifyDone()}),s}fillSlowly({stopBeforeFinishing:e=!0}={}){if(this._isFilling)return;this._isFilling=!0;const t=100,s=this._fillTime/t;this._fillInterval=setInterval(()=>{this.set(this._selfProgress+1),e&&this._selfProgress>=99&&clearInterval(this._fillInterval)},s)}set(e){this._selfProgress=Math.min(e,100),this.notifyProgress(),this._selfProgress+T>=100&&this.finish()}finish(){this._fillInterval&&clearInterval(this._fillInterval),this._selfDone=!0,this._selfProgress=100,this._isFilling=!1,this._fillInterval=void 0,this.notifyProgress(),this.notifyDone()}get caption(){for(let e=this._subTrackers.length-1;e>=0;e--)if(!this._subTrackers[e].done){const t=this._subTrackers[e].caption;if(t)return t}return this._selfCaption}setCaption(e){this._selfCaption=e,this.notifyProgress()}get done(){return this.progress+T>=100}get progress(){if(this._selfDone)return 100;const e=this._subTrackers.reduce((t,s)=>t+s.progress*s.weight,this._selfProgress*this._selfWeight);return Math.round(e*1e4)/1e4}get weight(){return this._weight}get observer(){return this._progressObserver||(this._progressObserver=e=>{this.set(e)}),this._progressObserver}get loadingListener(){return this._loadingListener||(this._loadingListener=e=>{this.set(e.detail.loaded/e.detail.total*100)}),this._loadingListener}pipe(e){e.setProgress({progress:this.progress,caption:this.caption}),this.addEventListener("progress",t=>{e.setProgress({progress:t.detail.progress,caption:t.detail.caption})}),this.addEventListener("done",()=>{e.setLoaded()})}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}notifyProgress(){const e=this;this.dispatchEvent(new CustomEvent("progress",{detail:{get progress(){return e.progress},get caption(){return e.caption}}}))}notifyDone(){this.dispatchEvent(new CustomEvent("done"))}}exports.EmscriptenDownloadMonitor=k;exports.ProgressObserver=W;exports.ProgressTracker=S;exports.cloneResponseMonitorProgress=I;
|
package/index.js
CHANGED
|
@@ -1,35 +1,95 @@
|
|
|
1
|
-
var L = (
|
|
2
|
-
if (!e.has(
|
|
1
|
+
var L = (r, e, t) => {
|
|
2
|
+
if (!e.has(r))
|
|
3
3
|
throw TypeError("Cannot " + t);
|
|
4
4
|
};
|
|
5
|
-
var l = (
|
|
6
|
-
if (e.has(
|
|
5
|
+
var l = (r, e, t) => (L(r, e, "read from private field"), t ? t.call(r) : e.get(r)), d = (r, e, t) => {
|
|
6
|
+
if (e.has(r))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
|
-
e instanceof WeakSet ? e.add(
|
|
9
|
-
},
|
|
10
|
-
var P = (
|
|
8
|
+
e instanceof WeakSet ? e.add(r) : e.set(r, t);
|
|
9
|
+
}, y = (r, e, t, s) => (L(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t);
|
|
10
|
+
var P = (r, e, t, s) => ({
|
|
11
11
|
set _(n) {
|
|
12
|
-
|
|
12
|
+
y(r, e, n, t);
|
|
13
13
|
},
|
|
14
14
|
get _() {
|
|
15
|
-
return l(
|
|
15
|
+
return l(r, e, s);
|
|
16
16
|
}
|
|
17
|
-
}),
|
|
18
|
-
|
|
19
|
-
class
|
|
17
|
+
}), u = (r, e, t) => (L(r, e, "access private method"), t);
|
|
18
|
+
if (typeof File > "u") {
|
|
19
|
+
class r extends Blob {
|
|
20
|
+
constructor(t, s, n) {
|
|
21
|
+
super(t);
|
|
22
|
+
let i;
|
|
23
|
+
n != null && n.lastModified && (i = /* @__PURE__ */ new Date()), (!i || isNaN(i.getFullYear())) && (i = /* @__PURE__ */ new Date()), this.lastModifiedDate = i, this.lastModified = i.getMilliseconds(), this.name = s || "";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
global.File = r;
|
|
27
|
+
}
|
|
28
|
+
function F(r) {
|
|
29
|
+
return new Promise(function(e, t) {
|
|
30
|
+
r.onload = r.onerror = function(s) {
|
|
31
|
+
r.onload = r.onerror = null, s.type === "load" ? e(r.result) : t(new Error("Failed to read the blob/file"));
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
typeof Blob.prototype.arrayBuffer > "u" && (Blob.prototype.arrayBuffer = function() {
|
|
36
|
+
const e = new FileReader();
|
|
37
|
+
return e.readAsArrayBuffer(this), F(e);
|
|
38
|
+
});
|
|
39
|
+
typeof Blob.prototype.text > "u" && (Blob.prototype.text = function() {
|
|
40
|
+
const e = new FileReader();
|
|
41
|
+
return e.readAsText(this), F(e);
|
|
42
|
+
});
|
|
43
|
+
function A() {
|
|
44
|
+
const r = new Uint8Array([1, 2, 3, 4]), t = new File([r], "test").stream();
|
|
45
|
+
try {
|
|
46
|
+
return t.getReader({ mode: "byob" }), t.getReader({ mode: "byob" }), !0;
|
|
47
|
+
} catch {
|
|
48
|
+
return !1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
(typeof Blob.prototype.stream > "u" || !A()) && (Blob.prototype.stream = function() {
|
|
52
|
+
let r = 0;
|
|
53
|
+
const e = this;
|
|
54
|
+
return new ReadableStream({
|
|
55
|
+
type: "bytes",
|
|
56
|
+
// 0.5 MB seems like a reasonable chunk size, let's adjust
|
|
57
|
+
// this if needed.
|
|
58
|
+
autoAllocateChunkSize: 512 * 1024,
|
|
59
|
+
async pull(t) {
|
|
60
|
+
const s = t.byobRequest.view, i = await e.slice(r, r + s.byteLength).arrayBuffer(), a = new Uint8Array(i);
|
|
61
|
+
new Uint8Array(s.buffer).set(a);
|
|
62
|
+
const o = a.byteLength;
|
|
63
|
+
t.byobRequest.respond(o), r += o, r >= e.size && t.close();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
if (typeof CustomEvent > "u") {
|
|
68
|
+
class r extends Event {
|
|
69
|
+
constructor(t, s = {}) {
|
|
70
|
+
super(t, s), this.detail = s.detail;
|
|
71
|
+
}
|
|
72
|
+
initCustomEvent() {
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
globalThis.CustomEvent = r;
|
|
76
|
+
}
|
|
77
|
+
const D = 5 * 1024 * 1024;
|
|
78
|
+
var g, p, w, S, E, B, b, v;
|
|
79
|
+
class W extends EventTarget {
|
|
20
80
|
constructor(t = []) {
|
|
21
81
|
super();
|
|
22
82
|
/**
|
|
23
83
|
* Replaces the default WebAssembly.instantiateStreaming with a version
|
|
24
84
|
* that monitors the download #progress.
|
|
25
85
|
*/
|
|
26
|
-
d(this,
|
|
86
|
+
d(this, w);
|
|
27
87
|
/**
|
|
28
88
|
* Creates a `dataFileDownloads` Proxy object that can be passed
|
|
29
89
|
* to `startPHP` to monitor the download #progress of the data
|
|
30
90
|
* dependencies.
|
|
31
91
|
*/
|
|
32
|
-
d(this,
|
|
92
|
+
d(this, E);
|
|
33
93
|
/**
|
|
34
94
|
* Notifies about the download #progress of a file.
|
|
35
95
|
*
|
|
@@ -37,78 +97,78 @@ class A extends EventTarget {
|
|
|
37
97
|
* @param loaded The number of bytes of that file loaded so far.
|
|
38
98
|
* @param fileSize The total number of bytes in the loaded file.
|
|
39
99
|
*/
|
|
40
|
-
d(this,
|
|
41
|
-
d(this,
|
|
100
|
+
d(this, b);
|
|
101
|
+
d(this, g, {});
|
|
42
102
|
d(this, p, {});
|
|
43
|
-
this.setModules(t),
|
|
103
|
+
this.setModules(t), u(this, w, S).call(this);
|
|
44
104
|
}
|
|
45
105
|
getEmscriptenOptions() {
|
|
46
106
|
return {
|
|
47
|
-
dataFileDownloads:
|
|
107
|
+
dataFileDownloads: u(this, E, B).call(this)
|
|
48
108
|
};
|
|
49
109
|
}
|
|
50
110
|
setModules(t) {
|
|
51
|
-
|
|
111
|
+
y(this, g, t.reduce((s, n) => {
|
|
52
112
|
if (n.dependenciesTotalSize > 0) {
|
|
53
|
-
const
|
|
113
|
+
const i = "http://example.com/", o = new URL(n.dependencyFilename, i).pathname.split("/").pop();
|
|
54
114
|
s[o] = Math.max(
|
|
55
115
|
o in s ? s[o] : 0,
|
|
56
116
|
n.dependenciesTotalSize
|
|
57
117
|
);
|
|
58
118
|
}
|
|
59
119
|
return s;
|
|
60
|
-
}, {})),
|
|
61
|
-
Object.entries(l(this,
|
|
120
|
+
}, {})), y(this, p, Object.fromEntries(
|
|
121
|
+
Object.entries(l(this, g)).map(([s]) => [s, 0])
|
|
62
122
|
));
|
|
63
123
|
}
|
|
64
124
|
}
|
|
65
|
-
|
|
125
|
+
g = new WeakMap(), p = new WeakMap(), w = new WeakSet(), S = function() {
|
|
66
126
|
const t = WebAssembly.instantiateStreaming;
|
|
67
127
|
WebAssembly.instantiateStreaming = async (s, ...n) => {
|
|
68
|
-
const
|
|
69
|
-
new URL(
|
|
70
|
-
), o =
|
|
71
|
-
|
|
72
|
-
({ detail: { loaded: h, total: c } }) =>
|
|
128
|
+
const i = await s, a = i.url.substring(
|
|
129
|
+
new URL(i.url).origin.length + 1
|
|
130
|
+
), o = O(
|
|
131
|
+
i,
|
|
132
|
+
({ detail: { loaded: h, total: c } }) => u(this, b, v).call(this, a, h, c)
|
|
73
133
|
);
|
|
74
134
|
return t(o, ...n);
|
|
75
135
|
};
|
|
76
|
-
},
|
|
136
|
+
}, E = new WeakSet(), B = function() {
|
|
77
137
|
const t = this, s = {};
|
|
78
138
|
return new Proxy(s, {
|
|
79
|
-
set(n,
|
|
139
|
+
set(n, i, a) {
|
|
80
140
|
var o;
|
|
81
|
-
return
|
|
82
|
-
set(h, c,
|
|
83
|
-
var
|
|
84
|
-
return h[c] =
|
|
141
|
+
return u(o = t, b, v).call(o, i, a.loaded, a.total), n[i] = new Proxy(JSON.parse(JSON.stringify(a)), {
|
|
142
|
+
set(h, c, M) {
|
|
143
|
+
var x;
|
|
144
|
+
return h[c] = M, u(x = t, b, v).call(x, i, h.loaded, h.total), !0;
|
|
85
145
|
}
|
|
86
146
|
}), !0;
|
|
87
147
|
}
|
|
88
148
|
});
|
|
89
|
-
},
|
|
90
|
-
const
|
|
91
|
-
n || (n = l(this,
|
|
92
|
-
`Registered a download #progress of an unregistered file "${
|
|
93
|
-
), l(this, p)[
|
|
149
|
+
}, b = new WeakSet(), v = function(t, s, n) {
|
|
150
|
+
const i = new URL(t, "http://example.com").pathname.split("/").pop();
|
|
151
|
+
n || (n = l(this, g)[i]), i in l(this, p) || console.warn(
|
|
152
|
+
`Registered a download #progress of an unregistered file "${i}". This may cause a sudden **decrease** in the #progress percentage as the total number of bytes increases during the download.`
|
|
153
|
+
), l(this, p)[i] = s, this.dispatchEvent(
|
|
94
154
|
new CustomEvent("progress", {
|
|
95
155
|
detail: {
|
|
96
156
|
loaded: C(l(this, p)),
|
|
97
|
-
total: C(l(this,
|
|
157
|
+
total: C(l(this, g))
|
|
98
158
|
}
|
|
99
159
|
})
|
|
100
160
|
);
|
|
101
161
|
};
|
|
102
|
-
function C(
|
|
103
|
-
return Object.values(
|
|
162
|
+
function C(r) {
|
|
163
|
+
return Object.values(r).reduce((e, t) => e + t, 0);
|
|
104
164
|
}
|
|
105
|
-
function
|
|
106
|
-
const t =
|
|
107
|
-
function n(
|
|
165
|
+
function O(r, e) {
|
|
166
|
+
const t = r.headers.get("content-length") || "", s = parseInt(t, 10) || D;
|
|
167
|
+
function n(i, a) {
|
|
108
168
|
e(
|
|
109
169
|
new CustomEvent("progress", {
|
|
110
170
|
detail: {
|
|
111
|
-
loaded:
|
|
171
|
+
loaded: i,
|
|
112
172
|
total: a
|
|
113
173
|
}
|
|
114
174
|
})
|
|
@@ -116,62 +176,62 @@ function D(i, e) {
|
|
|
116
176
|
}
|
|
117
177
|
return new Response(
|
|
118
178
|
new ReadableStream({
|
|
119
|
-
async start(
|
|
120
|
-
if (!
|
|
121
|
-
|
|
179
|
+
async start(i) {
|
|
180
|
+
if (!r.body) {
|
|
181
|
+
i.close();
|
|
122
182
|
return;
|
|
123
183
|
}
|
|
124
|
-
const a =
|
|
184
|
+
const a = r.body.getReader();
|
|
125
185
|
let o = 0;
|
|
126
186
|
for (; ; )
|
|
127
187
|
try {
|
|
128
188
|
const { done: h, value: c } = await a.read();
|
|
129
189
|
if (c && (o += c.byteLength), h) {
|
|
130
|
-
n(o, o),
|
|
190
|
+
n(o, o), i.close();
|
|
131
191
|
break;
|
|
132
192
|
} else
|
|
133
|
-
n(o, s),
|
|
193
|
+
n(o, s), i.enqueue(c);
|
|
134
194
|
} catch (h) {
|
|
135
|
-
console.error({ e: h }),
|
|
195
|
+
console.error({ e: h }), i.error(h);
|
|
136
196
|
break;
|
|
137
197
|
}
|
|
138
198
|
}
|
|
139
199
|
}),
|
|
140
200
|
{
|
|
141
|
-
status:
|
|
142
|
-
statusText:
|
|
143
|
-
headers:
|
|
201
|
+
status: r.status,
|
|
202
|
+
statusText: r.statusText,
|
|
203
|
+
headers: r.headers
|
|
144
204
|
}
|
|
145
205
|
);
|
|
146
206
|
}
|
|
147
|
-
var
|
|
148
|
-
class
|
|
207
|
+
var f, m, _, R;
|
|
208
|
+
class N extends EventTarget {
|
|
149
209
|
constructor() {
|
|
150
210
|
super(...arguments);
|
|
151
|
-
d(this,
|
|
152
|
-
d(this,
|
|
153
|
-
d(this,
|
|
154
|
-
|
|
211
|
+
d(this, _);
|
|
212
|
+
d(this, f, void 0);
|
|
213
|
+
d(this, m, void 0);
|
|
214
|
+
y(this, f, {}), y(this, m, 0), this.progress = 0, this.mode = "REAL_TIME", this.caption = "";
|
|
155
215
|
}
|
|
156
216
|
partialObserver(t, s = "") {
|
|
157
|
-
const n = ++P(this,
|
|
158
|
-
return l(this,
|
|
159
|
-
const { loaded: a, total: o } = (
|
|
160
|
-
l(this,
|
|
217
|
+
const n = ++P(this, m)._;
|
|
218
|
+
return l(this, f)[n] = 0, (i) => {
|
|
219
|
+
const { loaded: a, total: o } = (i == null ? void 0 : i.detail) || {};
|
|
220
|
+
l(this, f)[n] = a / o * t, u(this, _, R).call(this, this.totalProgress, "REAL_TIME", s);
|
|
161
221
|
};
|
|
162
222
|
}
|
|
163
223
|
slowlyIncrementBy(t) {
|
|
164
|
-
const s = ++P(this,
|
|
165
|
-
l(this,
|
|
224
|
+
const s = ++P(this, m)._;
|
|
225
|
+
l(this, f)[s] = t, u(this, _, R).call(this, this.totalProgress, "SLOWLY_INCREMENT");
|
|
166
226
|
}
|
|
167
227
|
get totalProgress() {
|
|
168
|
-
return Object.values(l(this,
|
|
228
|
+
return Object.values(l(this, f)).reduce(
|
|
169
229
|
(t, s) => t + s,
|
|
170
230
|
0
|
|
171
231
|
);
|
|
172
232
|
}
|
|
173
233
|
}
|
|
174
|
-
|
|
234
|
+
f = new WeakMap(), m = new WeakMap(), _ = new WeakSet(), R = function(t, s, n) {
|
|
175
235
|
this.dispatchEvent(
|
|
176
236
|
new CustomEvent("progress", {
|
|
177
237
|
detail: {
|
|
@@ -183,7 +243,7 @@ u = new WeakMap(), v = new WeakMap(), E = new WeakSet(), I = function(t, s, n) {
|
|
|
183
243
|
);
|
|
184
244
|
};
|
|
185
245
|
const T = 1e-5;
|
|
186
|
-
class
|
|
246
|
+
class I extends EventTarget {
|
|
187
247
|
constructor({
|
|
188
248
|
weight: e = 1,
|
|
189
249
|
caption: t = "",
|
|
@@ -232,7 +292,7 @@ class x extends EventTarget {
|
|
|
232
292
|
`Cannot add a stage with weight ${e} as the total weight of registered stages would exceed 1.`
|
|
233
293
|
);
|
|
234
294
|
this._selfWeight -= e;
|
|
235
|
-
const s = new
|
|
295
|
+
const s = new I({
|
|
236
296
|
caption: t,
|
|
237
297
|
weight: e,
|
|
238
298
|
fillTime: this._fillTime
|
|
@@ -350,8 +410,8 @@ class x extends EventTarget {
|
|
|
350
410
|
}
|
|
351
411
|
}
|
|
352
412
|
export {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
413
|
+
W as EmscriptenDownloadMonitor,
|
|
414
|
+
N as ProgressObserver,
|
|
415
|
+
I as ProgressTracker,
|
|
416
|
+
O as cloneResponseMonitorProgress
|
|
357
417
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/progress",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "PHP.wasm – loading progress monitoring",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,10 +29,12 @@
|
|
|
29
29
|
"type": "module",
|
|
30
30
|
"main": "index.js",
|
|
31
31
|
"types": "index.d.ts",
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "033b9df217c3b497ebaf0c6ac9a34c7004b55fdb",
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": ">=
|
|
34
|
+
"node": ">=18.18.2",
|
|
35
35
|
"npm": ">=8.11.0"
|
|
36
36
|
},
|
|
37
|
-
"dependencies": {
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@php-wasm/node-polyfills": "0.5.4"
|
|
39
|
+
}
|
|
38
40
|
}
|