Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@php-wasm/progress

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@php-wasm/progress - npm Package Compare versions

Comparing version 0.1.28 to 0.1.30

81

index.js

@@ -1,2 +0,2 @@

class c extends EventTarget {
class f extends EventTarget {
#e = {};

@@ -9,3 +9,3 @@ #t = {};

return {
dataFileDownloads: this.#i()
dataFileDownloads: this.#r()
};

@@ -16,3 +16,3 @@ }

if (s.dependenciesTotalSize > 0) {
const r = "http://example.com/", n = new URL(s.dependencyFilename, r).pathname.split("/").pop();
const i = "http://example.com/", n = new URL(s.dependencyFilename, i).pathname.split("/").pop();
t[n] = Math.max(

@@ -35,7 +35,7 @@ n in t ? t[n] : 0,

WebAssembly.instantiateStreaming = async (t, ...s) => {
const r = await t, i = r.url.substring(
new URL(r.url).origin.length + 1
const i = await t, r = i.url.substring(
new URL(i.url).origin.length + 1
), n = u(
r,
({ detail: { loaded: a, total: l } }) => this.#r(i, a, l)
i,
({ detail: { loaded: a, total: l } }) => this.#i(r, a, l)
);

@@ -50,9 +50,9 @@ return e(n, ...s);

*/
#i() {
#r() {
const e = this, t = {};
return new Proxy(t, {
set(s, r, i) {
return e.#r(r, i.loaded, i.total), s[r] = new Proxy(JSON.parse(JSON.stringify(i)), {
set(s, i, r) {
return e.#i(i, r.loaded, r.total), s[i] = new Proxy(JSON.parse(JSON.stringify(r)), {
set(n, a, l) {
return n[a] = l, e.#r(r, n.loaded, n.total), !0;
return n[a] = l, e.#i(i, n.loaded, n.total), !0;
}

@@ -70,11 +70,11 @@ }), !0;

*/
#r(e, t, s) {
const r = new URL(e, "http://example.com").pathname.split("/").pop();
s || (s = this.#e[r]), r in this.#t || console.warn(
`Registered a download #progress of an unregistered file "${r}". This may cause a sudden **decrease** in the #progress percentage as the total number of bytes increases during the download.`
#i(e, t, s) {
const i = new URL(e, "http://example.com").pathname.split("/").pop();
s || (s = this.#e[i]), i in this.#t || 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.`
), this.#t[e] = t, this.dispatchEvent(
new CustomEvent("progress", {
detail: {
loaded: d(this.#t),
total: d(this.#e)
loaded: g(this.#t),
total: g(this.#e)
}

@@ -85,3 +85,3 @@ })

}
function d(o) {
function g(o) {
return Object.values(o).reduce((e, t) => e + t, 0);

@@ -91,7 +91,7 @@ }

const t = o.headers.get("content-length") || "", s = parseInt(t, 10) || 5242880;
function r(i, n) {
function i(r, n) {
e(
new CustomEvent("progress", {
detail: {
loaded: i,
loaded: r,
total: n

@@ -104,5 +104,5 @@ }

new ReadableStream({
async start(i) {
async start(r) {
if (!o.body) {
i.close();
r.close();
return;

@@ -114,10 +114,10 @@ }

try {
const { done: l, value: h } = await n.read();
if (h && (a += h.byteLength), l) {
r(a, a), i.close();
const { done: l, value: d } = await n.read();
if (d && (a += d.byteLength), l) {
i(a, a), r.close();
break;
} else
r(a, s), i.enqueue(h);
i(a, s), r.enqueue(d);
} catch (l) {
console.error({ e: l }), i.error(l);
console.error({ e: l }), r.error(l);
break;

@@ -134,3 +134,3 @@ }

}
class f extends EventTarget {
class p extends EventTarget {
constructor() {

@@ -143,5 +143,5 @@ super(...arguments), this.#e = {}, this.#t = 0, this.progress = 0, this.mode = "REAL_TIME", this.caption = "";

const s = ++this.#t;
return this.#e[s] = 0, (r) => {
const { loaded: i, total: n } = r?.detail || {};
this.#e[s] = i / n * e, this.#s(this.totalProgress, "REAL_TIME", t);
return this.#e[s] = 0, (i) => {
const { loaded: r, total: n } = i?.detail || {};
this.#e[s] = r / n * e, this.#s(this.totalProgress, "REAL_TIME", t);
};

@@ -171,3 +171,4 @@ }

}
class g extends EventTarget {
const h = 1e-5;
class c extends EventTarget {
constructor({

@@ -216,3 +217,3 @@ weight: e = 1,

stage(e, t = "") {
if (e || (e = this._selfWeight), this._selfWeight - e < -Number.EPSILON)
if (e || (e = this._selfWeight), this._selfWeight - e < -h)
throw new Error(

@@ -222,3 +223,3 @@ `Cannot add a stage with weight ${e} as the total weight of registered stages would exceed 1.`

this._selfWeight -= e;
const s = new g({
const s = new c({
caption: t,

@@ -260,3 +261,3 @@ weight: e,

set(e) {
this._selfProgress = Math.min(e, 100), this.notifyProgress(), this._selfProgress + Number.EPSILON >= 100 && this.finish();
this._selfProgress = Math.min(e, 100), this.notifyProgress(), this._selfProgress + h >= 100 && this.finish();
}

@@ -279,3 +280,3 @@ finish() {

get done() {
return this.progress + Number.EPSILON >= 100;
return this.progress + h >= 100;
}

@@ -286,3 +287,3 @@ get progress() {

this._selfProgress * this._selfWeight
);
) + h;
}

@@ -338,6 +339,6 @@ get weight() {

export {
c as EmscriptenDownloadMonitor,
f as ProgressObserver,
g as ProgressTracker,
f as EmscriptenDownloadMonitor,
p as ProgressObserver,
c as ProgressTracker,
u as cloneResponseMonitorProgress
};
{
"name": "@php-wasm/progress",
"version": "0.1.28",
"version": "0.1.30",
"description": "PHP.wasm – loading progress monitoring",

@@ -32,4 +32,4 @@ "repository": {

"types": "index.d.ts",
"gitHead": "883860eacc7c37377f772a26919e700749020e4c",
"gitHead": "df3e9bff1de33d53d026c35a6ba5534aeff21a78",
"dependencies": {}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc