reactotron-react-js
Version:
A development tool to explore, inspect, and diagnose your React JS/DOM apps.
2 lines (1 loc) • 2.17 kB
JavaScript
import{createClient}from"reactotron-core-client";import StackTrace from"stacktrace-js";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}var CANNOT_RESOLVE_ERROR="Unable to resolve error. Either support CORS by changing webpack's devtool to \"source-map\" or run in offline mode.",PLUGIN_DEFAULTS={offline:!1},trackGlobalErrors=function(a){return function(b){function c(a,c,d,e,h){StackTrace.fromError(h,{offline:f.offline}).then(function(c){return b.error(a,c)})["catch"](function(f){return b.error({message:CANNOT_RESOLVE_ERROR,original:{msg:a,file:c,line:d,col:e,error:h},resolvingError:f})}),g&&g(a,c,d,e,h)}function d(){h||(g=window.onerror,window.onerror=c,h=!0)}function e(){g&&(window.onerror=g,h=!1)}var f=Object.assign({},PLUGIN_DEFAULTS,a||{}),g=null,h=!1;return d(),{features:{trackGlobalErrors:d,untrackGlobalErrors:e}}}},REACTOTRON_ASYNC_CLIENT_ID="@REACTOTRON/clientId";function isBrowser(){return"undefined"!=typeof window}function getNavigatorProperty(a){return a?isBrowser()?window.navigator||"object"===_typeof(window.navigator)?window.navigator[a]:void 0:void 0:void 0}var DEFAULTS={createSocket:function b(a){return new WebSocket(a)},host:"localhost",port:9090,name:"React JS App",client:{},getClientId:function a(){return Promise.resolve(localStorage.getItem(REACTOTRON_ASYNC_CLIENT_ID))},setClientId:function b(a){return localStorage.setItem(REACTOTRON_ASYNC_CLIENT_ID,a),Promise.resolve()}};isBrowser()&&(DEFAULTS.client={reactotronLibraryName:"reactotron-react-js",reactotronLibraryVersion:"3.3.14",platform:"browser",platformVersion:getNavigatorProperty("platform"),userAgent:getNavigatorProperty("userAgent"),screenWidth:screen&&screen.width||void 0,screenHeight:screen&&screen.height||void 0,screenScale:window&&window.devicePixelRatio||1,windowWidth:window&&window.innerWidth||void 0,windowHeight:window&&window.innerHeight||void 0});var index=createClient(DEFAULTS);export{index as default,trackGlobalErrors};