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
232
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.2.0-alpha.8 to 0.2.0-alpha.9

2

dist/index.cjs.js

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

"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{},P=class extends h{},O={get(e){},define(e,n,t){},upgrade(e){},whenDefined(e){return Promise.resolve(g)}},f,N=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:N,EventTarget:h,HTMLElement:g,HTMLVideoElement:P},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 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=`
<span id="viewer-count">

@@ -3,0 +3,0 @@ ${j}

@@ -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){},upgrade(e){},whenDefined(e){return Promise.resolve(b)}},g,P=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:P,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 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=`
<span id="viewer-count">
${W}
</span>
`;var a,T,U,h,f,N,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,N).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,N).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,N=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,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;})();
//# sourceMappingURL=mux-active-viewer-counts.js.map
{
"name": "@mux/mux-active-viewer-count",
"version": "0.2.0-alpha.8",
"version": "0.2.0-alpha.9",
"description": "A custom Mux element to show the current viewer count for the browser that Just Works™",

@@ -44,3 +44,3 @@ "keywords": [

"clean": "shx rm -rf dist/ && shx rm -rf src/polyfills",
"lint": "eslint src/ --ext .js,.jsx,.ts,.tsx",
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint src/ --ext .js,.jsx,.ts,.tsx",
"test": "web-test-runner **/*test.js --port 8006 --coverage --config test/web-test-runner.config.mjs --root-dir ../..",

@@ -67,4 +67,4 @@ "posttest": "replace 'SF:src/' 'SF:packages/mux-active-viewer-counts/src/' coverage/lcov.info --silent",

"@open-wc/testing": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.3.0",
"@web/dev-server-esbuild": "^1.0.2",

@@ -75,9 +75,9 @@ "@web/dev-server-import-maps": "^0.2.1",

"esbuild": "^0.19.8",
"eslint": "^8.24.0",
"eslint": "^9.9.1",
"npm-run-all": "^4.1.5",
"replace": "^1.2.1",
"shx": "^0.3.4",
"typescript": "^4.9.4"
"typescript": "^5.5.4"
},
"gitHead": "31bf5057d37d4e57b630012fc09d52daedb2973a"
"gitHead": "5ae58b9de16ae2dcd807276bb6539c1f8cfab800"
}

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

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