mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 19:09:18 +08:00
fix travis ci failed
This commit is contained in:
@@ -38,26 +38,26 @@ promiseStringArr = allResult;
|
||||
//race test
|
||||
var raceResult = Promise.race(arrayOfPromise);
|
||||
promiseString = raceResult;
|
||||
|
||||
|
||||
|
||||
//then test
|
||||
var thenWithPromiseResult = promiseString.then(word => Promise.resolve(word.length));
|
||||
promiseNumber = thenWithPromiseResult;
|
||||
|
||||
var thenWithPromiseResultAndPromiseReject = promiseString.then(word => Promise.resolve(word.length), error => Promise.resolve(10));
|
||||
promiseNumber = thenWithPromiseResultAndPromiseReject;
|
||||
promiseNumber = thenWithPromiseResultAndPromiseReject;
|
||||
|
||||
var thenWithPromiseResultAndSimpleReject = promiseString.then(word => Promise.resolve(word.length), error => 10);
|
||||
promiseNumber = thenWithPromiseResultAndSimpleReject;
|
||||
|
||||
promiseNumber = thenWithPromiseResultAndSimpleReject;
|
||||
|
||||
var thenWithSimpleResult = promiseString.then(word => word.length);
|
||||
promiseNumber = thenWithSimpleResult;
|
||||
|
||||
var thenWithSimpleResultAndPromiseReject = promiseString.then(word => word.length, error => Promise.resolve(10));
|
||||
promiseNumber = thenWithSimpleResultAndPromiseReject;
|
||||
promiseNumber = thenWithSimpleResultAndPromiseReject;
|
||||
|
||||
var thenWithSimpleResultAndSimpleReject = promiseString.then(word => word.length, error => 10);
|
||||
promiseNumber = thenWithSimpleResultAndSimpleReject;
|
||||
promiseNumber = thenWithSimpleResultAndSimpleReject;
|
||||
|
||||
var thenWithUndefinedFullFillAndSimpleReject = promiseString.then(undefined, error => 10);
|
||||
promiseNumber = thenWithUndefinedFullFillAndSimpleReject;
|
||||
@@ -71,13 +71,16 @@ promiseNumber = thenWithNoResultAndNoReject;
|
||||
var voidPromise = new Promise<void>(function (resolve) { resolve(); });
|
||||
|
||||
//catch test
|
||||
var catchWithSimpleResult = promiseString.catch(error => 10);
|
||||
var catchWithSimpleResult = promiseString.catch(error => 10);
|
||||
promiseNumber = catchWithSimpleResult;
|
||||
|
||||
var catchWithPromiseResult = promiseString.catch(error => Promise.resolve(10));
|
||||
var catchWithPromiseResult = promiseString.catch(error => Promise.resolve(10));
|
||||
promiseNumber = catchWithPromiseResult;
|
||||
|
||||
promiseString = promiseString.catch<string>(function () { throw new Error('Better error msg'); });
|
||||
promiseString = promiseString.catch<string>(function () {
|
||||
throw new Error('Better error msg');
|
||||
return null;
|
||||
});
|
||||
|
||||
//examples coming from http://www.html5rocks.com/en/tutorials/es6/promises/
|
||||
|
||||
@@ -87,7 +90,7 @@ function get(url: string) {
|
||||
// Do the usual XHR stuff
|
||||
var req = new XMLHttpRequest();
|
||||
req.open('GET', url);
|
||||
|
||||
|
||||
req.onload = function() {
|
||||
// This is called even on 404 etc
|
||||
// so check the status
|
||||
@@ -101,12 +104,12 @@ function get(url: string) {
|
||||
reject(Error(req.statusText));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Handle network errors
|
||||
req.onerror = function() {
|
||||
reject(Error("Network Error"));
|
||||
};
|
||||
|
||||
|
||||
// Make the request
|
||||
req.send();
|
||||
});
|
||||
@@ -119,11 +122,11 @@ function getJSON(url: string) {
|
||||
}
|
||||
|
||||
function addHtmlToPage(html: string) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function addTextToPage(text: string) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface Story {
|
||||
|
||||
Reference in New Issue
Block a user