UNPKG

@logsnag/remix

Version:

LogSnag client for Remix applications

3 lines 841 B
"use client"; import t from"react";var s="https://cdn.logsnag.com/web/ls.js";var m=({project:o,token:e,children:a})=>(typeof window!="undefined"&&(window.lsq=window.lsq||[],window.ls=window.ls||((...r)=>{var n;return(n=window.lsq)==null?void 0:n.push(r)})),t.useEffect(()=>{window.ls("setConfig",e,o);let r=document.createElement("script");return r.id="logsnag-script",r.src=s,r.async=!0,document.getElementById(r.id)||document.body.appendChild(r),()=>{document.body.removeChild(r)}},[o,e]),t.createElement(t.Fragment,null,a));var i=o=>{window.ls("setUserId",o)},d=()=>{window.ls("clearUserId")},p=(o=!0)=>{window.ls("setDebug",o)},c=o=>{window.ls("track",o)},l=o=>{window.ls("identify",o)};var w=()=>({setDebug:p,setUserId:i,clearUserId:d,track:c,identify:l});export{m as LogSnagProvider,w as useLogSnag}; //# sourceMappingURL=index.mjs.map