You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
8 months ago
|
(window.webpackETJsonp=window.webpackETJsonp||[]).push([[0],{788:function(e,t,n){"use strict";n.r(t),n.d(t,"Devtools",(function(){return M}));var i=n(2),o=n(93),r=n(95),s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.https,i=void 0!==n&&n,o=t.host,r=void 0===o?null:o,s=t.reconnect,a=void 0===s||s,u=t.reconnectInterval,l=void 0===u?1e4:u;if(c(this,e),this.host=r,this.https=i,this.version=0,!this.host)throw new Error('Devtools: You have to pass in the "host" option');this.backlog=[],this.isConnected=!1,this.ws=null,this.reconnectInterval=l,this.doReconnect=a,this.sendInitial=this.sendInitial.bind(this)}return a(e,[{key:"createSocket",value:function(){throw new Error('You have to implement a "createSocket" method')}},{key:"addListeners",value:function(){this.createSocket(),this.ws.onmessage=this.onMessage.bind(this)}},{key:"onMessage",value:function(e){}},{key:"reconnect",value:function(){var e=this;setTimeout((function(){e.init()}),this.reconnectInterval)}},{key:"init",value:function(){var e=this;this.addListeners(),this.ws.onopen=function(){e.ws.send(JSON.stringify({type:"ping"}))},this.ws.onerror=function(){},this.ws.onclose=function(){e.isConnected=!1,e.doReconnect&&(console.warn("Debugger application is not running on selected port... will reconnect automatically behind the scenes"),e.reconnect())}}},{key:"sendMessage",value:function(e){this.ws.send(e)}},{key:"sendBulkMessage",value:function(e,t){var n=JSON.stringify({type:"bulk",source:t,version:this.version,data:{messages:e}});this.sendMessage(n)}},{key:"watchExecution",value:function(e,t){var n=this;e.on("start",(function(e,i){var o=JSON.stringify({type:"executionStart",source:t,version:n.version,data:{execution:{executionId:e.id,name:e.name,staticTree:e.staticTree,datetime:e.datetime,executedBy:i&&i._execution?i._execution:null}}});n.sendExecutionMessage(o)})),e.on("end",(function(e){var i=JSON.stringify({type:"executionEnd",source:t,version:n.version,data:{execution:{executionId:e.id}}});n.latestExecutionId=e.id,n.sendExecutionMessage(i)})),e.on("pathStart",(function(e,i,o){var r=JSON.stringify({type:"executionPathStart",source:t,version:n.version,data:{execution:{executionId:i.id,functionIndex:o.functionIndex,path:e}}});n.sendExecutionMessage(r)})),e.on("functionStart",(function(e,i,o){var r=n.safeStringify({type:"execution",source:t,version:n.version,data:{execution:{executionId:e.id,functionIndex:i.functionIndex,payload:o,data:null}}});n.sendExecutionMessage(r)})),e.on("functionEnd",(function(e,i,o,s){if(!(!s||s instanceof r.a&&!s.payload)){var a=n.safeStringify({type:"executionFunctionEnd",source:t,version:n.version,data:{execution:{executionId:e.id,functionIndex:i.functionIndex,output:s instanceof r.a?s.payload:s}}});n.sendExecutionMessage(a)}})),e.on("error",(function(e,i,o){var r=JSON.stringify({type:"executionFunctionError",source:t,version:n.version,data:{execution:{executionId:i.id,functionIndex:o.functionIndex,error:{name:e.name,message:e.message,stack:e.stack,func:o.function.toString()}}}});n.sendExecutionMessage(r)}))}},{key:"safeStringify",value:function(e){var t=[];return JSON.stringify(e,(function(e,n){var i="object"===(void 0===n?"undefined":s(n))&&null!==n&&!Array.isArray(n);return i&&t.indexOf(n)>-1?"[CIRCULAR]":(i&&t.push(n),n)}))}},{key:"sendExecutionMessage",value:function(e){this.isConnected?this.sendMessage(e):this.backlog.push(e)}},{key:"sendInitial",value:function(){}},{key:"createExecutionMessage",value:function(e,t,n,i){}},{key:"sendExecutionData",value:
|