Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First attempt to connect Ergo connector to Yoroi
Includes some temporary testing such as "*" for target origin which should be changed back later. This communication is also just a first attempt and will open Yoroi in a tab to initialize the index.js for communcation and this will be changed in the future.
- Loading branch information
1 parent
617ea63
commit 59cc3e4
Showing
5 changed files
with
214 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
// TODO: put this somewhere common? | ||
const yoroiExtensionId = "bgihpbbhciffmelcfbccneidnnmkcdhl"; | ||
|
||
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { | ||
//alert("received from page: " + JSON.stringify(sender)); | ||
//alert("background message: " + JSON.stringify(sender)); | ||
if (request.type == "init_page_action") { | ||
chrome.pageAction.setPopup({ | ||
tabId: sender.tab.id, | ||
popup: "main.html" | ||
}); | ||
chrome.pageAction.show(sender.tab.id); | ||
} | ||
}); | ||
|
||
chrome.runtime.onMessageExternal.addListener(function(message, sender, sendResponse) { | ||
//alert("background external message: " + JSON.stringify(message)); | ||
if (sender.id == yoroiExtensionId) { | ||
if (message.type == "yoroi_connected") { | ||
chrome.tabs.query({active: true}, function(tabs) { | ||
chrome.tabs.sendMessage(tabs[0].id, {type: "yoroi_connected"}); | ||
}); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.