Skip to content

Commit

Permalink
fix: Separate axsReady injection
Browse files Browse the repository at this point in the history
  • Loading branch information
reasje committed Mar 12, 2024
1 parent 6c4c7d1 commit 42a54d4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions logic/lib/src/domain/const/js_channel/js_channel_scripts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ class JSChannelScripts {
String axsWalletJSObjectName,
) =>
'window.$axsWalletJSObjectName = { callHandler: window.flutter_inappwebview.callHandler }';
static String axsWalletReadyInjectScript(
String axsReadyEvent,
) =>
'''
const event = new CustomEvent('$axsReadyEvent', {});
window.dispatchEvent(event);
''';

static String axsWalletJSHandler(
String axsWalletJSObjectName,
String eventName,
Map<String, dynamic> data,
) =>
'''
const event = new CustomEvent("$axsWalletJSObjectName", {
});
window.dispatchEvent(event);
''';
'window.$axsWalletJSObjectName.callHandler(\'$eventName\', $data)';

static String walletProviderInfoScript(
int chainId,
Expand Down

0 comments on commit 42a54d4

Please sign in to comment.