diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-07-31 12:30:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-31 12:30:31 -0400 |
commit | 00c5ae79833a641ccc5f7d31b6eea3e91db4cb71 (patch) | |
tree | e21cb14527e2bf6e74b36eeab75e994d52df37b6 /dev/database-vm.js | |
parent | 2d57d69b9ed3adf1241074f7eb29a588bec817a2 (diff) |
DictionaryImporterMediaLoader (#1860)
* Rename param for consistency
* Move media loading functionality into DictionaryImporterMediaLoader
* Create test class for media loading
* Remove unnecessary Blob/Image/URL functionality
Diffstat (limited to 'dev/database-vm.js')
-rw-r--r-- | dev/database-vm.js | 69 |
1 files changed, 9 insertions, 60 deletions
diff --git a/dev/database-vm.js b/dev/database-vm.js index 07d9bd5a..ebde5a2a 100644 --- a/dev/database-vm.js +++ b/dev/database-vm.js @@ -30,63 +30,6 @@ const chrome = { } }; -class Image { - constructor() { - this._src = ''; - this._loadCallbacks = []; - } - - get src() { - return this._src; - } - - set src(value) { - this._src = value; - this._delayTriggerLoad(); - } - - get naturalWidth() { - return 100; - } - - get naturalHeight() { - return 100; - } - - addEventListener(eventName, callback) { - if (eventName === 'load') { - this._loadCallbacks.push(callback); - } - } - - removeEventListener(eventName, callback) { - if (eventName === 'load') { - const index = this._loadCallbacks.indexOf(callback); - if (index >= 0) { - this._loadCallbacks.splice(index, 1); - } - } - } - - removeAttribute() { - // NOP - } - - async _delayTriggerLoad() { - await Promise.resolve(); - for (const callback of this._loadCallbacks) { - callback(); - } - } -} - -class Blob { - constructor(array, options) { - this._array = array; - this._options = options; - } -} - async function fetch(url2) { const extDir = path.join(__dirname, '..', 'ext'); let filePath; @@ -114,8 +57,6 @@ class DatabaseVM extends VM { constructor(globals={}) { super(Object.assign({ chrome, - Image, - Blob, fetch, indexedDB: global.indexedDB, IDBKeyRange: global.IDBKeyRange, @@ -127,6 +68,14 @@ class DatabaseVM extends VM { } } +class DatabaseVMDictionaryImporterMediaLoader { + async getImageResolution() { + // Placeholder values + return {width: 100, height: 100}; + } +} + module.exports = { - DatabaseVM + DatabaseVM, + DatabaseVMDictionaryImporterMediaLoader }; |