eligius 1.0.6 → 1.0.71

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.
@@ -1,22 +1,31 @@
1
+ import $ from 'jquery';
1
2
  import { isDefined } from 'ts-is-present';
2
3
  import fs from 'fs';
3
4
  import path from 'path';
4
5
  import lottie from 'lottie-web';
5
- import $ from 'jquery';
6
6
  import hotkeys from 'hotkeys-js';
7
7
  import { v4 } from 'uuid';
8
8
 
9
9
  function prepareValueForSerialization(value) {
10
10
  if (Array.isArray(value)) {
11
11
  return value.map(prepareValueForSerialization);
12
+ } else if (value instanceof $) {
13
+ return 'jQuery object';
12
14
  } else if (typeof value === 'object') {
13
15
  return Object.fromEntries(Object.entries(value).map(function (_ref) {
14
- var name = _ref[0],
15
- value = _ref[1];
16
- return [name, prepareValueForSerialization(value)];
16
+ var propName = _ref[0],
17
+ propValue = _ref[1];
18
+ return [propName, prepareValueForSerialization(propValue)];
17
19
  }));
18
20
  } else if (typeof value === 'function') {
19
- return value.toString();
21
+ var funcString = value.toString();
22
+ var paranIndex = funcString.indexOf('{');
23
+
24
+ if (paranIndex > -1) {
25
+ return funcString.substring(0, funcString.indexOf('{') + 1);
26
+ }
27
+
28
+ return funcString;
20
29
  }
21
30
 
22
31
  return value;
@@ -31,11 +40,19 @@ var DevToolEventListener = /*#__PURE__*/function () {
31
40
  var _proto = DevToolEventListener.prototype;
32
41
 
33
42
  _proto.handleEvent = function handleEvent(eventName, eventTopic, args) {
34
- this.agent.postMessage('eligius-diagnostics-event', {
43
+ var message = {
35
44
  eventName: eventName,
36
45
  eventTopic: eventTopic,
37
46
  args: prepareValueForSerialization(args)
38
- });
47
+ };
48
+
49
+ try {
50
+ this.agent.postMessage('eligius-diagnostics-event', message);
51
+ } catch (e) {
52
+ console.error('postmessage failed');
53
+ console.error(e);
54
+ console.log('message', message);
55
+ }
39
56
  };
40
57
 
41
58
  return DevToolEventListener;
@@ -2912,7 +2929,15 @@ var EngineFactory = /*#__PURE__*/function () {
2912
2929
  eventbus.registerEventlistener(eventbusListener);
2913
2930
 
2914
2931
  Diagnostics.send = function (name, data) {
2915
- agent.postMessage(name, data);
2932
+ var message = prepareValueForSerialization(data);
2933
+
2934
+ try {
2935
+ agent.postMessage(name, message);
2936
+ } catch (e) {
2937
+ console.error('postmessage failed');
2938
+ console.error(e);
2939
+ console.log('message', message);
2940
+ }
2916
2941
  };
2917
2942
 
2918
2943
  Diagnostics.send('eligius-diagnostics-factory', 'Diagnostics initialized');