Skip to content

Commit

Permalink
Remove Sentry from event API (#224)
Browse files Browse the repository at this point in the history
* Remove Sentry from event API

* Add GemWallet cdn build
  • Loading branch information
FlorianBouron authored Jul 31, 2023
1 parent d8a73b2 commit 7041acd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
3 changes: 1 addition & 2 deletions dist/gemwallet-api.js

Large diffs are not rendered by default.

18 changes: 6 additions & 12 deletions packages/api/src/on/on.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import * as Sentry from '@sentry/react';

import { EventEventListener, GEM_WALLET } from '@gemwallet/constants';

export const on = (eventType: string, callback: (payload: any) => void) => {
window.addEventListener('message', (event: EventEventListener) => {
try {
// We only accept messages from ourselves
if (event.origin !== window.origin) return;
if (event.source !== window && event.data.app === GEM_WALLET) return;
if (!event.data.source || event.data.source !== 'GEM_WALLET_MSG_REQUEST') return;
// We only accept messages from ourselves
if (event.origin !== window.origin) return;
if (event.source !== window && event.data.app === GEM_WALLET) return;
if (!event.data.source || event.data.source !== 'GEM_WALLET_MSG_REQUEST') return;

if (event.data.type && event.data.type === eventType) {
callback(event.data.payload.result);
}
} catch (error) {
Sentry.captureException(error);
if (event.data.type && event.data.type === eventType) {
callback(event.data.payload.result);
}
});
};

0 comments on commit 7041acd

Please sign in to comment.