aboutsummaryrefslogtreecommitdiff
path: root/ext/js/background/offscreen-proxy.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-27 14:55:27 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-27 14:55:27 -0500
commit7aed9a371b0d74c0d75179a08068e8935b76d780 (patch)
tree2d895b20e31cb03c8200e4429d987c6d253b1da7 /ext/js/background/offscreen-proxy.js
parent5dc16745468c229e7c31f6cddaad83fb9c36b98f (diff)
Update types
Diffstat (limited to 'ext/js/background/offscreen-proxy.js')
-rw-r--r--ext/js/background/offscreen-proxy.js27
1 files changed, 24 insertions, 3 deletions
diff --git a/ext/js/background/offscreen-proxy.js b/ext/js/background/offscreen-proxy.js
index c01f523d..0fb2f269 100644
--- a/ext/js/background/offscreen-proxy.js
+++ b/ext/js/background/offscreen-proxy.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {deserializeError, isObject} from '../core.js';
+import {isObject} from '../core.js';
import {ArrayBufferUtil} from '../data/sandbox/array-buffer-util.js';
export class OffscreenProxy {
@@ -158,15 +158,36 @@ export class TranslatorProxy {
}
export class ClipboardReaderProxy {
+ /**
+ * @param {OffscreenProxy} offscreen
+ */
constructor(offscreen) {
+ /** @type {?import('environment').Browser} */
+ this._browser = null;
+ /** @type {OffscreenProxy} */
this._offscreen = offscreen;
}
+ /** @type {?import('environment').Browser} */
+ get browser() { return this._browser; }
+ set browser(value) {
+ if (this._browser === value) { return; }
+ this._browser = value;
+ this._offscreen.sendMessagePromise({action: 'clipboardSetBrowserOffsecreen', params: {value}});
+ }
+
+ /**
+ * @param {boolean} useRichText
+ * @returns {Promise<string>}
+ */
async getText(useRichText) {
- return this._offscreen.sendMessagePromise({action: 'clipboardGetTextOffscreen', params: {useRichText}});
+ return await this._offscreen.sendMessagePromise({action: 'clipboardGetTextOffscreen', params: {useRichText}});
}
+ /**
+ * @returns {Promise<?string>}
+ */
async getImage() {
- return this._offscreen.sendMessagePromise({action: 'clipboardGetImageOffscreen'});
+ return await this._offscreen.sendMessagePromise({action: 'clipboardGetImageOffscreen'});
}
}