Skip to content

Commit 2871908

Browse files
committed
fix adding multiple elements at once to queue proxy
closes #5
1 parent c167279 commit 2871908

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

apps/debugger-extension/entrypoints/collector.content.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,19 @@ export default defineContentScript({
7878

7979
internal_queue = value;
8080
const originalPush = value.push;
81-
value.push = (args) => {
82-
if (!Array.isArray(args)) {
83-
console.log(`[JSTC DEBUGGER] some invalid value pushed to the ${queueName}`);
84-
} else {
81+
value.push = (...args) => {
82+
for (const arg of args) {
8583
sendMessage({
8684
type: messageEventType,
8785
source: 'JSTC_DBG',
8886
payload: {
89-
data: formatPushArgs(args),
87+
data: formatPushArgs(arg),
9088
stack: new Error().stack,
9189
},
9290
});
9391
}
94-
originalPush(args);
92+
93+
originalPush(...args);
9594
};
9695
return;
9796
}
@@ -114,7 +113,6 @@ export default defineContentScript({
114113
// Piwik/PPAS object, when that object is defined we are sure that JSTC has loaded
115114
set: function (value) {
116115
if (Array.isArray(internal_queue)) {
117-
// TODO: send message that JSTC has been initialized
118116
internal_queue.forEach((args) => {
119117
if (!Array.isArray(args)) {
120118
return;

0 commit comments

Comments
 (0)