mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
replace es6-promise with Q
This commit is contained in:
parent
01b34ec1fb
commit
a199fd08c1
@ -5,6 +5,7 @@
|
|||||||
"es6": true
|
"es6": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"new-cap": [2, {newIsCap: true, capIsNew: false}],
|
||||||
"quotes": [2, "single"],
|
"quotes": [2, "single"],
|
||||||
"eol-last": [0],
|
"eol-last": [0],
|
||||||
"no-mixed-requires": [0],
|
"no-mixed-requires": [0],
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import alt from '../alt';
|
import alt from '../alt';
|
||||||
|
import Q from 'q';
|
||||||
|
|
||||||
import EditionListFetcher from '../fetchers/edition_list_fetcher.js';
|
import EditionListFetcher from '../fetchers/edition_list_fetcher.js';
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ class EditionListActions {
|
|||||||
pageSize = 10;
|
pageSize = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return Q.Promise((resolve, reject) => {
|
||||||
EditionListFetcher
|
EditionListFetcher
|
||||||
.fetch(pieceId, page, pageSize, orderBy, orderAsc)
|
.fetch(pieceId, page, pageSize, orderBy, orderAsc)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import alt from '../alt';
|
import alt from '../alt';
|
||||||
|
import Q from 'q';
|
||||||
|
|
||||||
import PieceListFetcher from '../fetchers/piece_list_fetcher';
|
import PieceListFetcher from '../fetchers/piece_list_fetcher';
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ class PieceListActions {
|
|||||||
|
|
||||||
// afterwards, we can load the list
|
// afterwards, we can load the list
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return Q.Promise((resolve, reject) => {
|
||||||
PieceListFetcher
|
PieceListFetcher
|
||||||
.fetch(page, pageSize, search, orderBy, orderAsc)
|
.fetch(page, pageSize, search, orderBy, orderAsc)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import Q from 'q';
|
||||||
|
|
||||||
import InjectInHeadMixin from '../../mixins/inject_in_head_mixin';
|
import InjectInHeadMixin from '../../mixins/inject_in_head_mixin';
|
||||||
import Panel from 'react-bootstrap/lib/Panel';
|
import Panel from 'react-bootstrap/lib/Panel';
|
||||||
import ProgressBar from 'react-bootstrap/lib/ProgressBar';
|
import ProgressBar from 'react-bootstrap/lib/ProgressBar';
|
||||||
@ -47,7 +49,7 @@ let Image = React.createClass({
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.inject('https://code.jquery.com/jquery-2.1.4.min.js')
|
this.inject('https://code.jquery.com/jquery-2.1.4.min.js')
|
||||||
.then(() =>
|
.then(() =>
|
||||||
Promise.all([
|
Q.all([
|
||||||
this.inject(AppConstants.baseUrl + 'static/thirdparty/shmui/shmui.css'),
|
this.inject(AppConstants.baseUrl + 'static/thirdparty/shmui/shmui.css'),
|
||||||
this.inject(AppConstants.baseUrl + 'static/thirdparty/shmui/jquery.shmui.js')
|
this.inject(AppConstants.baseUrl + 'static/thirdparty/shmui/jquery.shmui.js')
|
||||||
]).then(() => { window.jQuery('.shmui-ascribe').shmui(); }));
|
]).then(() => { window.jQuery('.shmui-ascribe').shmui(); }));
|
||||||
@ -99,7 +101,7 @@ let Video = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
Promise.all([
|
Q.all([
|
||||||
this.inject('//vjs.zencdn.net/4.12/video-js.css'),
|
this.inject('//vjs.zencdn.net/4.12/video-js.css'),
|
||||||
this.inject('//vjs.zencdn.net/4.12/video.js')
|
this.inject('//vjs.zencdn.net/4.12/video.js')
|
||||||
]).then(this.ready);
|
]).then(this.ready);
|
||||||
|
@ -518,7 +518,7 @@ var ReactS3FineUploader = React.createClass({
|
|||||||
// To react after the computation of all files, we define the resolvement
|
// To react after the computation of all files, we define the resolvement
|
||||||
// with the all function for iterables and essentially replace all original files
|
// with the all function for iterables and essentially replace all original files
|
||||||
// with their txt representative
|
// with their txt representative
|
||||||
Promise.all(convertedFilePromises)
|
Q.all(convertedFilePromises)
|
||||||
.then((convertedFiles) => {
|
.then((convertedFiles) => {
|
||||||
|
|
||||||
// actually replacing all files with their txt-hash representative
|
// actually replacing all files with their txt-hash representative
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
import Q from 'q';
|
||||||
|
|
||||||
let mapAttr = {
|
let mapAttr = {
|
||||||
link: 'href',
|
link: 'href',
|
||||||
script: 'src'
|
script: 'src'
|
||||||
@ -25,7 +27,7 @@ let InjectInHeadMixin = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
injectTag(tag, src) {
|
injectTag(tag, src) {
|
||||||
let promise = new Promise((resolve, reject) => {
|
return Q.Promise((resolve, reject) => {
|
||||||
if (InjectInHeadMixin.isPresent(tag, src)) {
|
if (InjectInHeadMixin.isPresent(tag, src)) {
|
||||||
resolve();
|
resolve();
|
||||||
} else {
|
} else {
|
||||||
@ -44,8 +46,6 @@ let InjectInHeadMixin = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return promise;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
injectStylesheet(src) {
|
injectStylesheet(src) {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
import Q from 'q';
|
||||||
|
|
||||||
import { sanitize } from './general_utils';
|
import { sanitize } from './general_utils';
|
||||||
import AppConstants from '../constants/application_constants';
|
import AppConstants from '../constants/application_constants';
|
||||||
|
|
||||||
@ -86,7 +88,7 @@ export function getCookie(name) {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
export function fetchImageAsBlob(url) {
|
export function fetchImageAsBlob(url) {
|
||||||
return new Promise((resolve, reject) => {
|
return Q.Promise((resolve, reject) => {
|
||||||
let xhr = new XMLHttpRequest();
|
let xhr = new XMLHttpRequest();
|
||||||
|
|
||||||
xhr.open('GET', url, true);
|
xhr.open('GET', url, true);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
import Q from 'q';
|
||||||
import SparkMD5 from 'spark-md5';
|
import SparkMD5 from 'spark-md5';
|
||||||
|
|
||||||
import { getLangText } from './lang_utils';
|
import { getLangText } from './lang_utils';
|
||||||
@ -28,7 +29,7 @@ function makeTextFile(text, file) {
|
|||||||
* @return {string} regular javascript string
|
* @return {string} regular javascript string
|
||||||
*/
|
*/
|
||||||
export function computeHashOfFile(file) {
|
export function computeHashOfFile(file) {
|
||||||
return new Promise((resolve, reject) => {
|
return Q.Promise((resolve, reject) => {
|
||||||
let blobSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;
|
let blobSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;
|
||||||
let chunkSize = 2097152; // Read in chunks of 2MB
|
let chunkSize = 2097152; // Read in chunks of 2MB
|
||||||
let chunks = Math.ceil(file.size / chunkSize);
|
let chunks = Math.ceil(file.size / chunkSize);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
import Q from 'q';
|
||||||
|
|
||||||
import { argsToQueryParams, getCookie } from '../utils/fetch_api_utils';
|
import { argsToQueryParams, getCookie } from '../utils/fetch_api_utils';
|
||||||
|
|
||||||
import AppConstants from '../constants/application_constants';
|
import AppConstants from '../constants/application_constants';
|
||||||
@ -22,7 +24,7 @@ class Requests {
|
|||||||
throw new Error(response.status + ' - ' + response.statusText + ' - on URL:' + response.url);
|
throw new Error(response.status + ' - ' + response.statusText + ' - on URL:' + response.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return Q.Promise((resolve, reject) => {
|
||||||
response.text()
|
response.text()
|
||||||
.then((responseText) => {
|
.then((responseText) => {
|
||||||
// If the responses' body does not contain any data,
|
// If the responses' body does not contain any data,
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
"classnames": "^1.2.2",
|
"classnames": "^1.2.2",
|
||||||
"compression": "^1.4.4",
|
"compression": "^1.4.4",
|
||||||
"envify": "^3.4.0",
|
"envify": "^3.4.0",
|
||||||
"es6-promise": "^2.1.1",
|
|
||||||
"eslint": "^0.22.1",
|
"eslint": "^0.22.1",
|
||||||
"eslint-plugin-react": "^2.5.0",
|
"eslint-plugin-react": "^2.5.0",
|
||||||
"express": "^4.12.4",
|
"express": "^4.12.4",
|
||||||
@ -69,6 +68,7 @@
|
|||||||
"jest-cli": "^0.4.0",
|
"jest-cli": "^0.4.0",
|
||||||
"lodash": "^3.9.3",
|
"lodash": "^3.9.3",
|
||||||
"object-assign": "^2.0.0",
|
"object-assign": "^2.0.0",
|
||||||
|
"q": "^1.4.1",
|
||||||
"raven-js": "^1.1.19",
|
"raven-js": "^1.1.19",
|
||||||
"react": "^0.13.2",
|
"react": "^0.13.2",
|
||||||
"react-bootstrap": "~0.22.6",
|
"react-bootstrap": "~0.22.6",
|
||||||
@ -79,12 +79,12 @@
|
|||||||
"react-textarea-autosize": "^2.2.3",
|
"react-textarea-autosize": "^2.2.3",
|
||||||
"reactify": "^1.1.0",
|
"reactify": "^1.1.0",
|
||||||
"shmui": "^0.1.0",
|
"shmui": "^0.1.0",
|
||||||
|
"spark-md5": "~1.0.0",
|
||||||
"uglifyjs": "^2.4.10",
|
"uglifyjs": "^2.4.10",
|
||||||
"vinyl-buffer": "^1.0.0",
|
"vinyl-buffer": "^1.0.0",
|
||||||
"vinyl-source-stream": "^1.1.0",
|
"vinyl-source-stream": "^1.1.0",
|
||||||
"watchify": "^3.1.2",
|
"watchify": "^3.1.2",
|
||||||
"yargs": "^3.10.0",
|
"yargs": "^3.10.0"
|
||||||
"spark-md5": "~1.0.0"
|
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"scriptPreprocessor": "node_modules/babel-jest",
|
"scriptPreprocessor": "node_modules/babel-jest",
|
||||||
|
Loading…
Reference in New Issue
Block a user