mtxuilib 0.0.425 → 0.0.428

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const ServiceWorkerMain: () => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";const c={};import{jsx as r,jsxs as s}from"react/jsx-runtime";import{useEffect as o,useRef as t}from"react";import{MtButton as i}from"../../ui/ui-mt/Button";const a=()=>{const n=t();return o(()=>{typeof window!="undefined"&&"serviceWorker"in navigator&&navigator.serviceWorker.register(new URL("./worker.ts",c.url),{scope:"./"}).then(e=>{console.log("Service worker registered successfully. Scope:",e.scope)}).catch(e=>{console.error("Service worker registration failed:",e)})},[]),s("div",{className:"prose bg-slate-100",children:[r("p",{children:"WebWorker5"}),r(i,{onClick:()=>{console.log("fetch1"),fetch("/")},children:"fetch-test"})]})};export{a as ServiceWorkerMain};
@@ -0,0 +1 @@
1
+ export declare function pi(n: number): number;
@@ -0,0 +1 @@
1
+ function n(t){let r=0;for(let e=1;e<=t;e+=4)r+=1/e-1/(e+2);return 4*r}export{n as pi};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ var i=(e,s,c)=>new Promise((o,r)=>{var l=t=>{try{n(c.next(t))}catch(a){r(a)}},v=t=>{try{n(c.throw(t))}catch(a){r(a)}},n=t=>t.done?o(t.value):Promise.resolve(t.value).then(l,v);n((c=c.apply(e,s)).next())});import{pi as h}from"./lib";addEventListener("message",e=>{postMessage(h(e.data))});const d=()=>{self.addEventListener("install",()=>{console.log("service worker installed")})};d();const f=()=>{self.addEventListener("activate",()=>{console.log("service worker activated")})};f();const E="v3",g=e=>i(void 0,null,function*(){const s=yield fetch(e.request),c=s.clone();return yield(yield caches.open(E)).put(e.request,c),s}),p=()=>{console.log("setup service worker fetch event"),self.addEventListener("fetch",e=>{console.log("fetch event@serviceworker",e),e.respondWith(g(e).catch(()=>caches.match(e.request)).then(s=>s))})};p();