summaryrefslogtreecommitdiff
path: root/ext/fg/js/float.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-08-15 17:36:42 -0400
committerGitHub <noreply@github.com>2020-08-15 17:36:42 -0400
commit4d6851ec324a97bcbed9032060480dc332d42923 (patch)
tree008ae397e9833f43f34aa50e4086d3c10a77abf0 /ext/fg/js/float.js
parentd5865db457ef6f96aa32662a8219fdf73478ae20 (diff)
Refactor some frontend cross-frame communication (#733)
* Refactor iframe proxy setup * Simplify document title acquisition
Diffstat (limited to 'ext/fg/js/float.js')
-rw-r--r--ext/fg/js/float.js21
1 files changed, 2 insertions, 19 deletions
diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js
index 83c542d1..8a17a437 100644
--- a/ext/fg/js/float.js
+++ b/ext/fg/js/float.js
@@ -69,25 +69,8 @@ class DisplayFloat extends Display {
async getDocumentTitle() {
try {
- const uniqueId = yomichan.generateId(16);
-
- const promise = yomichan.getTemporaryListenerResult(
- chrome.runtime.onMessage,
- ({action, params}, {resolve}) => {
- if (
- action === 'documentInformationBroadcast' &&
- isObject(params) &&
- params.uniqueId === uniqueId &&
- params.frameId === 0
- ) {
- resolve(params);
- }
- },
- 2000
- );
- api.broadcastTab('requestDocumentInformationBroadcast', {uniqueId});
-
- const {title} = await promise;
+ const targetFrameId = 0;
+ const {title} = await api.crossFrame.invoke(targetFrameId, 'getDocumentInformation');
return title;
} catch (e) {
return '';