Skip to content

Commit

Permalink
Merge pull request #239 from OpenImaging/remove-bluebird
Browse files Browse the repository at this point in the history
switch to native promises
  • Loading branch information
annehaley authored Dec 2, 2021
2 parents 9063bff + 0676cd4 commit 637e1a6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 24 deletions.
6 changes: 0 additions & 6 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"@vue/composition-api": "^1.1.4",
"@vue/eslint-config-typescript": "^7.0.0",
"axios": "^0.21.4",
"bluebird": "^3.5.5",
"direct-vuex": "^0.12.1",
"gl-matrix": "^3.4.3",
"idle-vue": "^2.0.5",
Expand All @@ -39,7 +38,6 @@
"@babel/plugin-transform-block-scoping": "7.10.5",
"@babel/runtime": "7.11.0",
"@babel/runtime-corejs2": "7.11.0",
"@types/bluebird": "^3.5.36",
"@types/lodash": "^4.14.172",
"@types/uuid": "^8.3.1",
"@vue/cli-plugin-babel": "^3.3.0",
Expand Down
9 changes: 4 additions & 5 deletions client/src/store/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable no-use-before-define */

import BluebirdPromise from 'bluebird';
import { createDirectStore } from 'direct-vuex';
import Vue from 'vue';
import Vuex from 'vuex';
Expand Down Expand Up @@ -68,7 +67,7 @@ function getArrayName(filename) {
}

function getData(id, file, webWorker = null) {
return new BluebirdPromise((resolve, reject) => {
return new Promise((resolve, reject) => {
if (frameCache.has(id)) {
resolve({ frameData: frameCache.get(id), webWorker });
} else {
Expand Down Expand Up @@ -121,13 +120,13 @@ function loadFileAndGetData(frameId) {
return loadFile(frameId).fileP.then((file) => getData(frameId, file, savedWorker)
.then(({ webWorker, frameData }) => {
savedWorker = webWorker;
return BluebirdPromise.resolve({ frameData });
return Promise.resolve({ frameData });
})
.catch((error) => {
const msg = 'loadFileAndGetData caught error getting data';
console.log(msg);
console.log(error);
return BluebirdPromise.reject(msg);
return Promise.reject(msg);
})
.finally(() => {
if (savedWorker) {
Expand All @@ -138,7 +137,7 @@ function loadFileAndGetData(frameId) {
}

function poolFunction(webWorker, taskInfo) {
return new BluebirdPromise((resolve, reject) => {
return new Promise((resolve, reject) => {
const { frameId } = taskInfo;

let filePromise = null;
Expand Down
12 changes: 1 addition & 11 deletions client/src/utils/ReaderFactory.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import { CancelToken } from 'axios';
import Promise from 'bluebird';

Promise.config({
longStackTraces: false,
warnings: false, // note, run node with --trace-warnings to see full stack traces for warnings,
cancellation: true,
});

const READER_MAPPING = {};

Expand Down Expand Up @@ -104,7 +97,7 @@ function loadFiles(files) {
}

function downloadFrame(axios, fileName, url) {
return new Promise((resolve, reject, onCancel) => {
return new Promise((resolve, reject) => {
const readerMapping = getReader({ name: fileName });
if (readerMapping) {
const { readMethod } = readerMapping;
Expand All @@ -118,9 +111,6 @@ function downloadFrame(axios, fileName, url) {
}
})
.catch(reject);
onCancel(() => {
source.cancel('navigated away');
});
} else {
throw new Error(`No reader found for ${fileName}`);
}
Expand Down

0 comments on commit 637e1a6

Please sign in to comment.