Skip to content

Commit

Permalink
v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz Przodała authored and Mariusz Przodała committed Sep 27, 2023
1 parent b5450ac commit e814071
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"version": "2.0.0",
"version": "2.0.1",
"name": "Eventrix devtools",
"short_name": "Eventrix devtools",
"description": "Extension for Eventrix",
"permissions": ["activeTab", "scripting"],
"host_permissions": ["<all_urls>"],
"devtools_page": "devtools.html",
"action": {
"default_assets/icon": {
Expand Down
10 changes: 7 additions & 3 deletions src/DevtoolsPanel/services/debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class DebuggerService {
}

isJSON = (str) => {
if (str.length === 0) return false;
if (!str || str.length === 0) return false;
const firstChar = str[0];
const lastChar = str[str.length - 1];
const isObject = firstChar === '{' && lastChar === '}';
Expand All @@ -147,9 +147,13 @@ class DebuggerService {
const parsedEventPayload = this.isJSON(eventPayload) ? JSON.parse(eventPayload) : eventPayload;
return new Promise((resolve) => {
chrome.devtools.inspectedWindow.eval(
`${WINDOW_EVENTRIX_DEBUGGER_NAME}.eventrix.emit(${eventName}, ${parsedEventPayload})`,
`${WINDOW_EVENTRIX_DEBUGGER_NAME}.eventrix.emit('${eventName}', ${eventPayload})`,
(result = [], isException) => {
resolve(result || []);
if(isException) {
console.log('error', isException);
} else {
resolve(result || []);
}
}
);
})
Expand Down

0 comments on commit e814071

Please sign in to comment.