summaryrefslogtreecommitdiff
path: root/ext/fg/js/float.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-02-14 11:00:36 +0200
committerGitHub <noreply@github.com>2020-02-14 11:00:36 +0200
commitc09a3ded1d694887e4e9ff48cc3c387abdbb2065 (patch)
treeaf4a70e78ecc76a9e93ffcd23323f48c9da89d35 /ext/fg/js/float.js
parente645296b1b5e993355844f2cb2b026b87d05759e (diff)
parent810a7e7d92d15412974810702d954de60453dd31 (diff)
Merge pull request #357 from siikamiika/simplify-display-prepare
Simplify display prepare
Diffstat (limited to 'ext/fg/js/float.js')
-rw-r--r--ext/fg/js/float.js32
1 files changed, 17 insertions, 15 deletions
diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js
index d31b8336..418c69b6 100644
--- a/ext/fg/js/float.js
+++ b/ext/fg/js/float.js
@@ -34,6 +34,22 @@ class DisplayFloat extends Display {
window.addEventListener('message', (e) => this.onMessage(e), false);
}
+ async prepare(options, popupInfo, url, childrenSupported, scale) {
+ await super.prepare(options);
+
+ const {id, depth, parentFrameId} = popupInfo;
+ this.optionsContext.depth = depth;
+ this.optionsContext.url = url;
+
+ if (childrenSupported) {
+ popupNestedInitialize(id, depth, parentFrameId, url);
+ }
+
+ this.setContentScale(scale);
+
+ apiForward('popupSetDisplayInitialized');
+ }
+
onError(error) {
if (this._orphaned) {
this.setContent('orphaned');
@@ -93,20 +109,6 @@ class DisplayFloat extends Display {
setContentScale(scale) {
document.body.style.fontSize = `${scale}em`;
}
-
- async initialize(options, popupInfo, url, childrenSupported, scale) {
- await super.initialize(options);
-
- const {id, depth, parentFrameId} = popupInfo;
- this.optionsContext.depth = depth;
- this.optionsContext.url = url;
-
- if (childrenSupported) {
- popupNestedInitialize(id, depth, parentFrameId, url);
- }
-
- this.setContentScale(scale);
- }
}
DisplayFloat._onKeyDownHandlers = new Map([
@@ -123,7 +125,7 @@ DisplayFloat._messageHandlers = new Map([
['setContent', (self, {type, details}) => self.setContent(type, details)],
['clearAutoPlayTimer', (self) => self.clearAutoPlayTimer()],
['setCustomCss', (self, {css}) => self.setCustomCss(css)],
- ['initialize', (self, {options, popupInfo, url, childrenSupported, scale}) => self.initialize(options, popupInfo, url, childrenSupported, scale)],
+ ['initialize', (self, {options, popupInfo, url, childrenSupported, scale}) => self.prepare(options, popupInfo, url, childrenSupported, scale)],
['setContentScale', (self, {scale}) => self.setContentScale(scale)]
]);