@nozbe/periscope-client
Advanced tools
Comparing version 1.1.0-alpha.0 to 1.1.0
export declare type PeekableObject = { | ||
file: File; | ||
} | { | ||
url: string; | ||
}; | ||
@@ -4,0 +6,0 @@ |
@@ -1,11 +0,19 @@ | ||
var l = Object.defineProperty; | ||
var p = (i, e, t) => e in i ? l(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t; | ||
var n = (i, e, t) => (p(i, typeof e != "symbol" ? e + "" : e, t), t); | ||
var u = Object.defineProperty; | ||
var l = (i, e, t) => e in i ? u(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t; | ||
var n = (i, e, t) => (l(i, typeof e != "symbol" ? e + "" : e, t), t); | ||
function h(i) { | ||
return typeof i == "object" && i !== null; | ||
} | ||
function p(i) { | ||
if (typeof i == "string") | ||
try { | ||
return new URL(i), !0; | ||
} catch { | ||
} | ||
return !1; | ||
} | ||
function g(i) { | ||
return new Promise((e) => setTimeout(e, i)); | ||
} | ||
const a = { | ||
const r = { | ||
GoingUp: "going_up", | ||
@@ -20,3 +28,3 @@ Up: "up", | ||
n(this, "onTimeout"); | ||
n(this, "state", a.Down); | ||
n(this, "state", r.Down); | ||
n(this, "pendingPeek", null); | ||
@@ -32,9 +40,9 @@ n(this, "handleWindowMessage", (e) => { | ||
get isGoingUp() { | ||
return this.state === a.GoingUp; | ||
return this.state === r.GoingUp; | ||
} | ||
get isUp() { | ||
return this.state === a.Up; | ||
return this.state === r.Up; | ||
} | ||
get isDown() { | ||
return this.state === a.Down; | ||
return this.state === r.Down; | ||
} | ||
@@ -51,3 +59,3 @@ async up() { | ||
}; | ||
this.state = a.GoingUp, await Promise.race([e(), t()]).catch((s) => { | ||
this.state = r.GoingUp, await Promise.race([e(), t()]).catch((s) => { | ||
var o; | ||
@@ -63,3 +71,3 @@ if (s instanceof Error && s.message === "ConnectionTimeout") | ||
down() { | ||
this.isUp && this.messageOutlet({ type: "down" }), window.removeEventListener("message", this.handleWindowMessage), this.state = a.Down; | ||
this.isUp && this.messageOutlet({ type: "down" }), window.removeEventListener("message", this.handleWindowMessage), this.state = r.Down; | ||
} | ||
@@ -78,3 +86,3 @@ peek(e) { | ||
const t = e.data; | ||
t.type === "down" && this.isUp ? this.down() : t.type === "roger" && this.isGoingUp && (this.state = a.Up, this.pendingPeek && (this.messageOutlet({ type: "peek", object: this.pendingPeek }), this.pendingPeek = null)); | ||
t.type === "down" && this.isUp ? this.down() : t.type === "roger" && this.isGoingUp && (this.state = r.Up, this.pendingPeek && (this.messageOutlet({ type: "peek", object: this.pendingPeek }), this.pendingPeek = null)); | ||
} | ||
@@ -86,9 +94,9 @@ messageOutlet(e) { | ||
} | ||
const r = { | ||
const a = { | ||
GoingUp: "going_up", | ||
Down: "down" | ||
}; | ||
class c { | ||
class w { | ||
constructor() { | ||
n(this, "state", r.Down); | ||
n(this, "state", a.Down); | ||
n(this, "peekHandlers", /* @__PURE__ */ new Set()); | ||
@@ -100,6 +108,6 @@ n(this, "handleWindowMessage", (e) => { | ||
get isDown() { | ||
return this.state === r.Down; | ||
return this.state === a.Down; | ||
} | ||
get isGoingUp() { | ||
return this.state === r.GoingUp; | ||
return this.state === a.GoingUp; | ||
} | ||
@@ -113,6 +121,6 @@ get isUp() { | ||
up() { | ||
this.isDown && (this.state = r.GoingUp, window.addEventListener("message", this.handleWindowMessage)); | ||
this.isDown && (this.state = a.GoingUp, window.addEventListener("message", this.handleWindowMessage)); | ||
} | ||
down() { | ||
this.isUp && this.messageInlet({ type: "down" }), this.state = r.Down, window.removeEventListener("message", this.handleWindowMessage), this.peekHandlers.clear(); | ||
this.isUp && this.messageInlet({ type: "down" }), this.state = a.Down, window.removeEventListener("message", this.handleWindowMessage), this.peekHandlers.clear(); | ||
} | ||
@@ -142,3 +150,3 @@ onPeek(e) { | ||
const { object: s } = t; | ||
return h(s) && s.file instanceof File; | ||
return h(s) && (s.file instanceof File || p(s.url)); | ||
} | ||
@@ -165,3 +173,3 @@ default: | ||
d as PeriscopeInlet, | ||
c as PeriscopeOutlet | ||
w as PeriscopeOutlet | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "1.1.0-alpha.0", | ||
"version": "1.1.0", | ||
"type": "module", | ||
@@ -28,3 +28,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "9e3d937b6018f01a6196f8a808e972a731207326" | ||
"gitHead": "807d5ced8c593d2dbd1ab8bff154e7ab658b7053" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8566
5
211
1
1
18