insite-cookie
Version:
Cookie support for inSite
3 lines (2 loc) • 1.19 kB
JavaScript
var L=Object.defineProperty;var u=o=>{throw TypeError(o)};var E=(o,t,e)=>t in o?L(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var p=(o,t,e)=>E(o,typeof t!="symbol"?t+"":t,e),c=(o,t,e)=>t.has(o)||u("Cannot "+e);var h=(o,t,e)=>(c(o,t,"read from private field"),e?e.call(o):t.get(o)),i=(o,t,e)=>t.has(o)?u("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e),l=(o,t,e,n)=>(c(o,t,"write to private field"),n?n.call(o,e):t.set(o,e),e);var m={set:"~setcookie"};var r,s,d,a=class a{constructor(t,e={}){p(this,"method");p(this,"url");i(this,r);i(this,s);i(this,d,t=>{let e=new XMLHttpRequest;e.onload=h(this,r),e.onerror=h(this,s),e.open(this.method,`${this.url}?${t}`,!0),e.send(null)});let{method:n="GET",url:x="/cookie",onload:M=a.onXhrLoad,onerror:y=a.onXhrError}=e;this.method=n,this.url=x,l(this,r,M),l(this,s,y),t.on(`message:${m.set}`,h(this,d))}static onXhrLoad(){this.readyState===4&&this.status!==200&&console.error("Set cookie:",this.statusText)}static onXhrError(){console.error("Set cookie:",this.statusText)}};r=new WeakMap,s=new WeakMap,d=new WeakMap;var X=a;export{X as CookieSetter};
//# sourceMappingURL=index.js.map