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

@mux/mux-active-viewer-count

Package Overview
Dependencies
Maintainers
0
Versions
271
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mux/mux-active-viewer-count - npm Package Compare versions

Comparing version 0.1.1-canary.251 to 0.1.1-canary.252

6

dist/index.cjs.js

@@ -1,6 +0,6 @@

"use strict";var C=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var M=(e,n)=>{for(var t in n)C(e,t,{get:n[t],enumerable:!0})},W=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of q(n))!z.call(e,o)&&o!==t&&C(e,o,{get:()=>n[o],enumerable:!(i=H(n,o))||i.enumerable});return e};var J=e=>W(C({},"__esModule",{value:!0}),e);var _=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)};var a=(e,n,t)=>(_(e,n,"read from private field"),t?t.call(e):n.get(e)),l=(e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)},u=(e,n,t,i)=>(_(e,n,"write to private field"),i?i.call(e,t):n.set(e,t),t);var d=(e,n,t)=>(_(e,n,"access private method"),t);var et={};M(et,{default:()=>tt,subscribeViewerCount:()=>U});module.exports=J(et);var h=class{addEventListener(){}removeEventListener(){}dispatchEvent(n){return!0}};if(typeof DocumentFragment=="undefined"){class e extends h{}globalThis.DocumentFragment=e}var g=class extends h{},N=class extends h{},O={get(e){},define(e,n,t){},getName(e){return null},upgrade(e){},whenDefined(e){return Promise.resolve(g)}},f,P=class{constructor(n,t={}){l(this,f,void 0);u(this,f,t==null?void 0:t.detail)}get detail(){return a(this,f)}initCustomEvent(){}};f=new WeakMap;function Q(e,n){return new g}var S={document:{createElement:Q},DocumentFragment,customElements:O,CustomEvent:P,EventTarget:h,HTMLElement:g,HTMLVideoElement:N},F=typeof window=="undefined"||typeof globalThis.customElements=="undefined",w=F?S:globalThis,st=F?S.document:globalThis.document;var U=(e,n,t,i)=>{let o=`https://stats.mux.com/counts?token=${e}`,R=new AbortController,B=R.signal,v,k=!1,x=()=>k?Promise.resolve():fetch(o,{signal:B}).then(s=>s.json()).then(s=>{var V,y,D;let p=(y=(V=s==null?void 0:s.data)==null?void 0:V[0])==null?void 0:y.views;return s!=null&&s.error||p==null?Promise.reject((D=s==null?void 0:s.error)!=null?D:"no data in response"):(t(p),p)}).catch(i).then(()=>new Promise(s=>{v=setTimeout(()=>{s(void 0)},n*1e3)})).then(x);return x(),()=>{k=!0,R.abort(),typeof v=="number"&&(clearTimeout(v),v=void 0)}},r={TOKEN:"token",POLL_INTERVAL:"poll-interval",DISABLED:"disabled"},X=20,Y=Object.freeze(Object.values(r)),Z="Viewer Count",j="??",$=({viewerCount:e})=>{let n=typeof e=="number"?`${e}`:"Unknown";return`${Z} ${n}`},G=document.createElement("template");G.innerHTML=`
"use strict";var T=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var y=e=>{throw TypeError(e)};var z=(e,n)=>{for(var t in n)T(e,t,{get:n[t],enumerable:!0})},M=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of H(n))!q.call(e,i)&&i!==t&&T(e,i,{get:()=>n[i],enumerable:!(r=B(n,i))||r.enumerable});return e};var W=e=>M(T({},"__esModule",{value:!0}),e);var p=(e,n,t)=>n.has(e)||y("Cannot "+t);var a=(e,n,t)=>(p(e,n,"read from private field"),t?t.call(e):n.get(e)),d=(e,n,t)=>n.has(e)?y("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,t),u=(e,n,t,r)=>(p(e,n,"write to private field"),r?r.call(e,t):n.set(e,t),t),h=(e,n,t)=>(p(e,n,"access private method"),t);var tt={};z(tt,{default:()=>j,subscribeViewerCount:()=>$});module.exports=W(tt);var m=class{addEventListener(){}removeEventListener(){}dispatchEvent(n){return!0}};if(typeof DocumentFragment=="undefined"){class e extends m{}globalThis.DocumentFragment=e}var g=class extends m{},C=class extends m{},J={get(e){},define(e,n,t){},getName(e){return null},upgrade(e){},whenDefined(e){return Promise.resolve(g)}},f,_=class{constructor(n,t={}){d(this,f);u(this,f,t==null?void 0:t.detail)}get detail(){return a(this,f)}initCustomEvent(){}};f=new WeakMap;function O(e,n){return new g}var D={document:{createElement:O},DocumentFragment,customElements:J,CustomEvent:_,EventTarget:m,HTMLElement:g,HTMLVideoElement:C},S=typeof window=="undefined"||typeof globalThis.customElements=="undefined",v=S?D:globalThis,nt=S?D.document:globalThis.document;var $=(e,n,t,r)=>{let i=`https://stats.mux.com/counts?token=${e}`,P=new AbortController,K=P.signal,E,I=!1,R=()=>I?Promise.resolve():fetch(i,{signal:K}).then(s=>s.json()).then(s=>{var k,x,V;let L=(x=(k=s==null?void 0:s.data)==null?void 0:k[0])==null?void 0:x.views;return s!=null&&s.error||L==null?Promise.reject((V=s==null?void 0:s.error)!=null?V:"no data in response"):(t(L),L)}).catch(r).then(()=>new Promise(s=>{E=setTimeout(()=>{s(void 0)},n*1e3)})).then(R);return R(),()=>{I=!0,P.abort(),typeof E=="number"&&(clearTimeout(E),E=void 0)}},l={TOKEN:"token",POLL_INTERVAL:"poll-interval",DISABLED:"disabled"},Q=20,X=Object.freeze(Object.values(l)),Y="Viewer Count",Z="??",F=({viewerCount:e})=>{let n=typeof e=="number"?`${e}`:"Unknown";return`${Y} ${n}`},U=document.createElement("template");U.innerHTML=`
<span id="viewer-count">
${j}
${Z}
</span>
`;var c,T,K,m,E,I,b,A,L=class extends w.HTMLElement{constructor(){super();l(this,T);l(this,E);l(this,b);l(this,c,void 0);l(this,m,void 0);this.attachShadow({mode:"open"}).appendChild(G.content.cloneNode(!0))}static get observedAttributes(){return Y}get views(){var t;return(t=a(this,m))!=null?t:Number.NaN}get token(){var t;return(t=this.getAttribute(r.TOKEN))!=null?t:""}set token(t){this.token!==t&&(u(this,m,void 0),this.setAttribute(r.TOKEN,t))}get pollInterval(){let t=this.hasAttribute(r.POLL_INTERVAL)?+this.getAttribute(r.POLL_INTERVAL):X;return t<15&&(console.warn("Poll interval must be at least 15 seconds, setting to 15."),t=15),t}set pollInterval(t){this.pollInterval!==t&&this.setAttribute(r.POLL_INTERVAL,`${t}`)}enable(){this.setAttribute("tabindex","0")}disable(){this.removeAttribute("tabindex")}connectedCallback(){this.hasAttribute("disabled")||this.enable(),this.setAttribute("aria-label",$({})),this.setAttribute("role","presentation"),d(this,E,I).call(this)}disconnectedCallback(){d(this,b,A).call(this)}attributeChangedCallback(t,i,o){t===r.POLL_INTERVAL||t===r.TOKEN?(d(this,b,A).call(this),d(this,E,I).call(this)):t===r.DISABLED&&i!==o&&(o?this.disable():this.enable())}};c=new WeakMap,T=new WeakSet,K=function(){return this.shadowRoot.querySelector("#viewer-count")},m=new WeakMap,E=new WeakSet,I=function(){this.token&&this.pollInterval&&!a(this,c)&&u(this,c,U(this.token,this.pollInterval,t=>{u(this,m,t),this.dispatchEvent(new CustomEvent("change",{detail:t})),a(this,T,K).textContent=`${this.views}`,this.setAttribute("aria-label",$({viewerCount:t}))},t=>{this.dispatchEvent(new CustomEvent("error",{detail:t})),console.warn("Failed to retrieve viewer count: Error - ",t),d(this,b,A).call(this)}))},b=new WeakSet,A=function(){var t;(t=a(this,c))==null||t.call(this),u(this,c,void 0)};w.customElements.get("mux-active-viewer-count")||w.customElements.define("mux-active-viewer-count",L);var tt=L;
`;var c,o,G,b,N,w,A=class extends v.HTMLElement{constructor(){super();d(this,o);d(this,c);d(this,b);this.attachShadow({mode:"open"}).appendChild(U.content.cloneNode(!0))}static get observedAttributes(){return X}get views(){var t;return(t=a(this,b))!=null?t:Number.NaN}get token(){var t;return(t=this.getAttribute(l.TOKEN))!=null?t:""}set token(t){this.token!==t&&(u(this,b,void 0),this.setAttribute(l.TOKEN,t))}get pollInterval(){let t=this.hasAttribute(l.POLL_INTERVAL)?+this.getAttribute(l.POLL_INTERVAL):Q;return t<15&&(console.warn("Poll interval must be at least 15 seconds, setting to 15."),t=15),t}set pollInterval(t){this.pollInterval!==t&&this.setAttribute(l.POLL_INTERVAL,`${t}`)}enable(){this.setAttribute("tabindex","0")}disable(){this.removeAttribute("tabindex")}connectedCallback(){this.hasAttribute("disabled")||this.enable(),this.setAttribute("aria-label",F({})),this.setAttribute("role","presentation"),h(this,o,N).call(this)}disconnectedCallback(){h(this,o,w).call(this)}attributeChangedCallback(t,r,i){t===l.POLL_INTERVAL||t===l.TOKEN?(h(this,o,w).call(this),h(this,o,N).call(this)):t===l.DISABLED&&r!==i&&(i?this.disable():this.enable())}};c=new WeakMap,o=new WeakSet,G=function(){return this.shadowRoot.querySelector("#viewer-count")},b=new WeakMap,N=function(){this.token&&this.pollInterval&&!a(this,c)&&u(this,c,$(this.token,this.pollInterval,t=>{u(this,b,t),this.dispatchEvent(new CustomEvent("change",{detail:t})),a(this,o,G).textContent=`${this.views}`,this.setAttribute("aria-label",F({viewerCount:t}))},t=>{this.dispatchEvent(new CustomEvent("error",{detail:t})),console.warn("Failed to retrieve viewer count: Error - ",t),h(this,o,w).call(this)}))},w=function(){var t;(t=a(this,c))==null||t.call(this),u(this,c,void 0)};v.customElements.get("mux-active-viewer-count")||v.customElements.define("mux-active-viewer-count",A);var j=A;
//# sourceMappingURL=index.cjs.js.map

@@ -1,6 +0,6 @@

"use strict";(()=>{var C=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)};var r=(e,n,t)=>(C(e,n,"read from private field"),t?t.call(e):n.get(e)),i=(e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)},l=(e,n,t,u)=>(C(e,n,"write to private field"),u?u.call(e,t):n.set(e,t),t);var c=(e,n,t)=>(C(e,n,"access private method"),t);var d=class{addEventListener(){}removeEventListener(){}dispatchEvent(n){return!0}};if(typeof DocumentFragment=="undefined"){class e extends d{}globalThis.DocumentFragment=e}var b=class extends d{},_=class extends d{},K={get(e){},define(e,n,t){},getName(e){return null},upgrade(e){},whenDefined(e){return Promise.resolve(b)}},g,N=class{constructor(n,t={}){i(this,g,void 0);l(this,g,t==null?void 0:t.detail)}get detail(){return r(this,g)}initCustomEvent(){}};g=new WeakMap;function B(e,n){return new b}var D={document:{createElement:B},DocumentFragment,customElements:K,CustomEvent:N,EventTarget:d,HTMLElement:b,HTMLVideoElement:_},S=typeof window=="undefined"||typeof globalThis.customElements=="undefined",w=S?D:globalThis,O=S?D.document:globalThis.document;var H=(e,n,t,u)=>{let E=`https://stats.mux.com/counts?token=${e}`,I=new AbortController,G=I.signal,v,R=!1,k=()=>R?Promise.resolve():fetch(E,{signal:G}).then(s=>s.json()).then(s=>{var x,V,y;let p=(V=(x=s==null?void 0:s.data)==null?void 0:x[0])==null?void 0:V.views;return s!=null&&s.error||p==null?Promise.reject((y=s==null?void 0:s.error)!=null?y:"no data in response"):(t(p),p)}).catch(u).then(()=>new Promise(s=>{v=setTimeout(()=>{s(void 0)},n*1e3)})).then(k);return k(),()=>{R=!0,I.abort(),typeof v=="number"&&(clearTimeout(v),v=void 0)}},o={TOKEN:"token",POLL_INTERVAL:"poll-interval",DISABLED:"disabled"},q=20,z=Object.freeze(Object.values(o)),M="Viewer Count",W="??",F=({viewerCount:e})=>{let n=typeof e=="number"?`${e}`:"Unknown";return`${M} ${n}`},$=document.createElement("template");$.innerHTML=`
"use strict";(()=>{var V=e=>{throw TypeError(e)};var T=(e,n,t)=>n.has(e)||V("Cannot "+t);var r=(e,n,t)=>(T(e,n,"read from private field"),t?t.call(e):n.get(e)),c=(e,n,t)=>n.has(e)?V("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,t),l=(e,n,t,u)=>(T(e,n,"write to private field"),u?u.call(e,t):n.set(e,t),t),d=(e,n,t)=>(T(e,n,"access private method"),t);var h=class{addEventListener(){}removeEventListener(){}dispatchEvent(n){return!0}};if(typeof DocumentFragment=="undefined"){class e extends h{}globalThis.DocumentFragment=e}var b=class extends h{},p=class extends h{},G={get(e){},define(e,n,t){},getName(e){return null},upgrade(e){},whenDefined(e){return Promise.resolve(b)}},g,C=class{constructor(n,t={}){c(this,g);l(this,g,t==null?void 0:t.detail)}get detail(){return r(this,g)}initCustomEvent(){}};g=new WeakMap;function K(e,n){return new b}var y={document:{createElement:K},DocumentFragment,customElements:G,CustomEvent:C,EventTarget:h,HTMLElement:b,HTMLVideoElement:p},D=typeof window=="undefined"||typeof globalThis.customElements=="undefined",v=D?y:globalThis,J=D?y.document:globalThis.document;var B=(e,n,t,u)=>{let f=`https://stats.mux.com/counts?token=${e}`,N=new AbortController,U=N.signal,E,P=!1,I=()=>P?Promise.resolve():fetch(f,{signal:U}).then(s=>s.json()).then(s=>{var R,k,x;let L=(k=(R=s==null?void 0:s.data)==null?void 0:R[0])==null?void 0:k.views;return s!=null&&s.error||L==null?Promise.reject((x=s==null?void 0:s.error)!=null?x:"no data in response"):(t(L),L)}).catch(u).then(()=>new Promise(s=>{E=setTimeout(()=>{s(void 0)},n*1e3)})).then(I);return I(),()=>{P=!0,N.abort(),typeof E=="number"&&(clearTimeout(E),E=void 0)}},i={TOKEN:"token",POLL_INTERVAL:"poll-interval",DISABLED:"disabled"},H=20,q=Object.freeze(Object.values(i)),z="Viewer Count",M="??",S=({viewerCount:e})=>{let n=typeof e=="number"?`${e}`:"Unknown";return`${z} ${n}`},F=document.createElement("template");F.innerHTML=`
<span id="viewer-count">
${W}
${M}
</span>
`;var a,T,U,h,f,P,m,A,L=class extends w.HTMLElement{constructor(){super();i(this,T);i(this,f);i(this,m);i(this,a,void 0);i(this,h,void 0);this.attachShadow({mode:"open"}).appendChild($.content.cloneNode(!0))}static get observedAttributes(){return z}get views(){var t;return(t=r(this,h))!=null?t:Number.NaN}get token(){var t;return(t=this.getAttribute(o.TOKEN))!=null?t:""}set token(t){this.token!==t&&(l(this,h,void 0),this.setAttribute(o.TOKEN,t))}get pollInterval(){let t=this.hasAttribute(o.POLL_INTERVAL)?+this.getAttribute(o.POLL_INTERVAL):q;return t<15&&(console.warn("Poll interval must be at least 15 seconds, setting to 15."),t=15),t}set pollInterval(t){this.pollInterval!==t&&this.setAttribute(o.POLL_INTERVAL,`${t}`)}enable(){this.setAttribute("tabindex","0")}disable(){this.removeAttribute("tabindex")}connectedCallback(){this.hasAttribute("disabled")||this.enable(),this.setAttribute("aria-label",F({})),this.setAttribute("role","presentation"),c(this,f,P).call(this)}disconnectedCallback(){c(this,m,A).call(this)}attributeChangedCallback(t,u,E){t===o.POLL_INTERVAL||t===o.TOKEN?(c(this,m,A).call(this),c(this,f,P).call(this)):t===o.DISABLED&&u!==E&&(E?this.disable():this.enable())}};a=new WeakMap,T=new WeakSet,U=function(){return this.shadowRoot.querySelector("#viewer-count")},h=new WeakMap,f=new WeakSet,P=function(){this.token&&this.pollInterval&&!r(this,a)&&l(this,a,H(this.token,this.pollInterval,t=>{l(this,h,t),this.dispatchEvent(new CustomEvent("change",{detail:t})),r(this,T,U).textContent=`${this.views}`,this.setAttribute("aria-label",F({viewerCount:t}))},t=>{this.dispatchEvent(new CustomEvent("error",{detail:t})),console.warn("Failed to retrieve viewer count: Error - ",t),c(this,m,A).call(this)}))},m=new WeakSet,A=function(){var t;(t=r(this,a))==null||t.call(this),l(this,a,void 0)};w.customElements.get("mux-active-viewer-count")||w.customElements.define("mux-active-viewer-count",L);var Z=L;})();
`;var a,o,$,m,_,w,A=class extends v.HTMLElement{constructor(){super();c(this,o);c(this,a);c(this,m);this.attachShadow({mode:"open"}).appendChild(F.content.cloneNode(!0))}static get observedAttributes(){return q}get views(){var t;return(t=r(this,m))!=null?t:Number.NaN}get token(){var t;return(t=this.getAttribute(i.TOKEN))!=null?t:""}set token(t){this.token!==t&&(l(this,m,void 0),this.setAttribute(i.TOKEN,t))}get pollInterval(){let t=this.hasAttribute(i.POLL_INTERVAL)?+this.getAttribute(i.POLL_INTERVAL):H;return t<15&&(console.warn("Poll interval must be at least 15 seconds, setting to 15."),t=15),t}set pollInterval(t){this.pollInterval!==t&&this.setAttribute(i.POLL_INTERVAL,`${t}`)}enable(){this.setAttribute("tabindex","0")}disable(){this.removeAttribute("tabindex")}connectedCallback(){this.hasAttribute("disabled")||this.enable(),this.setAttribute("aria-label",S({})),this.setAttribute("role","presentation"),d(this,o,_).call(this)}disconnectedCallback(){d(this,o,w).call(this)}attributeChangedCallback(t,u,f){t===i.POLL_INTERVAL||t===i.TOKEN?(d(this,o,w).call(this),d(this,o,_).call(this)):t===i.DISABLED&&u!==f&&(f?this.disable():this.enable())}};a=new WeakMap,o=new WeakSet,$=function(){return this.shadowRoot.querySelector("#viewer-count")},m=new WeakMap,_=function(){this.token&&this.pollInterval&&!r(this,a)&&l(this,a,B(this.token,this.pollInterval,t=>{l(this,m,t),this.dispatchEvent(new CustomEvent("change",{detail:t})),r(this,o,$).textContent=`${this.views}`,this.setAttribute("aria-label",S({viewerCount:t}))},t=>{this.dispatchEvent(new CustomEvent("error",{detail:t})),console.warn("Failed to retrieve viewer count: Error - ",t),d(this,o,w).call(this)}))},w=function(){var t;(t=r(this,a))==null||t.call(this),l(this,a,void 0)};v.customElements.get("mux-active-viewer-count")||v.customElements.define("mux-active-viewer-count",A);var Y=A;})();
//# sourceMappingURL=mux-active-viewer-counts.js.map
{
"name": "@mux/mux-active-viewer-count",
"version": "0.1.1-canary.251",
"version": "0.1.1-canary.252",
"description": "A custom Mux element to show the current viewer count for the browser that Just Works™",

@@ -28,6 +28,6 @@ "keywords": [

"exports": {
"types@<4.3.5": "./dist/types-ts3.4/index.d.ts",
"types": "./dist/types/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs.js",
"types@<4.3.5": "./dist/types-ts3.4/index.d.ts",
"types": "./dist/types/index.d.ts",
"default": "./dist/index.cjs.js"

@@ -65,15 +65,15 @@ },

"@open-wc/testing": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.3.0",
"@web/dev-server-esbuild": "^1.0.2",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"@web/dev-server-esbuild": "^1.0.3",
"@web/dev-server-import-maps": "^0.2.1",
"@web/test-runner": "^0.19.0",
"downlevel-dts": "^0.11.0",
"esbuild": "^0.19.8",
"eslint": "^9.9.1",
"esbuild": "^0.24.1",
"eslint": "^9.17.0",
"npm-run-all": "^4.1.5",
"replace": "^1.2.1",
"shx": "^0.3.4",
"typescript": "^5.5.4"
"typescript": "^5.7.2"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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