1
0
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:
Tim Daubenschütz 2015-07-24 13:44:28 +02:00
parent 01b34ec1fb
commit a199fd08c1
10 changed files with 24 additions and 14 deletions

View File

@ -5,6 +5,7 @@
"es6": true
},
"rules": {
"new-cap": [2, {newIsCap: true, capIsNew: false}],
"quotes": [2, "single"],
"eol-last": [0],
"no-mixed-requires": [0],

View File

@ -1,6 +1,7 @@
'use strict';
import alt from '../alt';
import Q from 'q';
import EditionListFetcher from '../fetchers/edition_list_fetcher.js';
@ -28,7 +29,7 @@ class EditionListActions {
pageSize = 10;
}
return new Promise((resolve, reject) => {
return Q.Promise((resolve, reject) => {
EditionListFetcher
.fetch(pieceId, page, pageSize, orderBy, orderAsc)
.then((res) => {

View File

@ -1,6 +1,7 @@
'use strict';
import alt from '../alt';
import Q from 'q';
import PieceListFetcher from '../fetchers/piece_list_fetcher';
@ -29,7 +30,7 @@ class PieceListActions {
// afterwards, we can load the list
return new Promise((resolve, reject) => {
return Q.Promise((resolve, reject) => {
PieceListFetcher
.fetch(page, pageSize, search, orderBy, orderAsc)
.then((res) => {

View File

@ -1,6 +1,8 @@
'use strict';
import React from 'react';
import Q from 'q';
import InjectInHeadMixin from '../../mixins/inject_in_head_mixin';
import Panel from 'react-bootstrap/lib/Panel';
import ProgressBar from 'react-bootstrap/lib/ProgressBar';
@ -47,7 +49,7 @@ let Image = React.createClass({
componentDidMount() {
this.inject('https://code.jquery.com/jquery-2.1.4.min.js')
.then(() =>
Promise.all([
Q.all([
this.inject(AppConstants.baseUrl + 'static/thirdparty/shmui/shmui.css'),
this.inject(AppConstants.baseUrl + 'static/thirdparty/shmui/jquery.shmui.js')
]).then(() => { window.jQuery('.shmui-ascribe').shmui(); }));
@ -99,7 +101,7 @@ let Video = React.createClass({
},
componentDidMount() {
Promise.all([
Q.all([
this.inject('//vjs.zencdn.net/4.12/video-js.css'),
this.inject('//vjs.zencdn.net/4.12/video.js')
]).then(this.ready);

View File

@ -518,7 +518,7 @@ var ReactS3FineUploader = React.createClass({
// 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 their txt representative
Promise.all(convertedFilePromises)
Q.all(convertedFilePromises)
.then((convertedFiles) => {
// actually replacing all files with their txt-hash representative

View File

@ -1,5 +1,7 @@
'use strict';
import Q from 'q';
let mapAttr = {
link: 'href',
script: 'src'
@ -25,7 +27,7 @@ let InjectInHeadMixin = {
},
injectTag(tag, src) {
let promise = new Promise((resolve, reject) => {
return Q.Promise((resolve, reject) => {
if (InjectInHeadMixin.isPresent(tag, src)) {
resolve();
} else {
@ -44,8 +46,6 @@ let InjectInHeadMixin = {
}
}
});
return promise;
},
injectStylesheet(src) {

View File

@ -1,5 +1,7 @@
'use strict';
import Q from 'q';
import { sanitize } from './general_utils';
import AppConstants from '../constants/application_constants';
@ -86,7 +88,7 @@ export function getCookie(name) {
*/
export function fetchImageAsBlob(url) {
return new Promise((resolve, reject) => {
return Q.Promise((resolve, reject) => {
let xhr = new XMLHttpRequest();
xhr.open('GET', url, true);

View File

@ -1,5 +1,6 @@
'use strict';
import Q from 'q';
import SparkMD5 from 'spark-md5';
import { getLangText } from './lang_utils';
@ -28,7 +29,7 @@ function makeTextFile(text, file) {
* @return {string} regular javascript string
*/
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 chunkSize = 2097152; // Read in chunks of 2MB
let chunks = Math.ceil(file.size / chunkSize);

View File

@ -1,5 +1,7 @@
'use strict';
import Q from 'q';
import { argsToQueryParams, getCookie } from '../utils/fetch_api_utils';
import AppConstants from '../constants/application_constants';
@ -22,7 +24,7 @@ class Requests {
throw new Error(response.status + ' - ' + response.statusText + ' - on URL:' + response.url);
}
return new Promise((resolve, reject) => {
return Q.Promise((resolve, reject) => {
response.text()
.then((responseText) => {
// If the responses' body does not contain any data,

View File

@ -49,7 +49,6 @@
"classnames": "^1.2.2",
"compression": "^1.4.4",
"envify": "^3.4.0",
"es6-promise": "^2.1.1",
"eslint": "^0.22.1",
"eslint-plugin-react": "^2.5.0",
"express": "^4.12.4",
@ -69,6 +68,7 @@
"jest-cli": "^0.4.0",
"lodash": "^3.9.3",
"object-assign": "^2.0.0",
"q": "^1.4.1",
"raven-js": "^1.1.19",
"react": "^0.13.2",
"react-bootstrap": "~0.22.6",
@ -79,12 +79,12 @@
"react-textarea-autosize": "^2.2.3",
"reactify": "^1.1.0",
"shmui": "^0.1.0",
"spark-md5": "~1.0.0",
"uglifyjs": "^2.4.10",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.1.2",
"yargs": "^3.10.0",
"spark-md5": "~1.0.0"
"yargs": "^3.10.0"
},
"jest": {
"scriptPreprocessor": "node_modules/babel-jest",