From b2b4bda74c20f7d9e6cd77e17ee99c94d74827c4 Mon Sep 17 00:00:00 2001 From: jim Date: Mon, 26 Sep 2016 17:02:28 +0800 Subject: [PATCH] remove es6 promise --- app.js | 2 +- package.json | 6 +- src/assets.d.ts | 1 - src/assets.ts | 2 - src/image-tile.d.ts | 1 - src/image-tile.ts | 2 - tsconfig.json | 2 +- typings.json | 1 - typings/globals/es6-promise/index.d.ts | 81 ------------------------ typings/globals/es6-promise/typings.json | 8 --- typings/index.d.ts | 1 - 11 files changed, 5 insertions(+), 102 deletions(-) delete mode 100644 typings/globals/es6-promise/index.d.ts delete mode 100644 typings/globals/es6-promise/typings.json diff --git a/app.js b/app.js index 1df1f03..c5d11a9 100644 --- a/app.js +++ b/app.js @@ -3,5 +3,5 @@ var app = express(); app.use(express.static(__dirname)); -console.log("http://localhost:8088/www/index.html"); +console.log("http://localhost:8088/demos/index.html"); app.listen(8088); diff --git a/package.json b/package.json index 61765b3..178a7e6 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,15 @@ { "name": "qtk", "version": "1.0.0", - "description": "a template project", + "description": "QToolKit", "main": "src/index.js", "types": "src/index.d.ts", "scripts": { "start": "node app.js", "clean": "rm -rf doc index.js coverage/ src/*.js", "test": "tsc && webpack && ./node_modules/karma/bin/karma start", - "build": "tsc && webpack", + "build": "tsc && webpack", + "postinstall": "tsc && webpack", "gendoc": "./node_modules/typedoc/bin/typedoc --mode modules --out doc src/" }, "repository": { @@ -39,7 +40,6 @@ }, "dependencies": { "carota": "git+https://github.com/qtoolkit/carota.git", - "es6-promise": "^3.2.1", "eventemitter3": "^1.2.0", "scroller": "0.0.3", "tween.js": "^16.3.5", diff --git a/src/assets.d.ts b/src/assets.d.ts index 809635a..1b55434 100644 --- a/src/assets.d.ts +++ b/src/assets.d.ts @@ -1,4 +1,3 @@ -/// /// /// /// diff --git a/src/assets.ts b/src/assets.ts index 302456d..7441642 100644 --- a/src/assets.ts +++ b/src/assets.ts @@ -1,4 +1,3 @@ -/// /// /// /// @@ -6,7 +5,6 @@ import "whatwg-fetch"; import path = require("path"); import Events = require("./events"); -import {Promise} from 'es6-promise'; import {Emitter} from "./emitter"; export const AUDIO = "audio"; diff --git a/src/image-tile.d.ts b/src/image-tile.d.ts index 15aeb61..2d54f2c 100644 --- a/src/image-tile.d.ts +++ b/src/image-tile.d.ts @@ -1,4 +1,3 @@ -/// /// /// import "whatwg-fetch"; diff --git a/src/image-tile.ts b/src/image-tile.ts index 07f11fc..6c44c2d 100644 --- a/src/image-tile.ts +++ b/src/image-tile.ts @@ -1,10 +1,8 @@ -/// /// /// import "whatwg-fetch"; import path = require("path"); -import {Promise} from 'es6-promise'; import {Emitter} from "./emitter"; import Assets = require("./assets"); import Events = require("./events"); diff --git a/tsconfig.json b/tsconfig.json index bf98d8e..0bf6d1c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "module": "commonjs", "target": "es5", "declaration": true, - "allowJs" : true + "lib": ["es6", "es2015", "dom"] }, "files": [ "src/assets.ts", diff --git a/typings.json b/typings.json index a4b69a4..e4fbf4f 100644 --- a/typings.json +++ b/typings.json @@ -2,7 +2,6 @@ "name": "foo", "dependencies": {}, "globalDependencies": { - "es6-promise": "registry:dt/es6-promise#0.0.0+20160614011821", "scroller": "registry:dt/scroller#0.0.0+20160316155526", "tween.js": "registry:dt/tween.js#0.0.0+20160608102153", "whatwg-fetch": "registry:dt/whatwg-fetch#0.0.0+20160728142841" diff --git a/typings/globals/es6-promise/index.d.ts b/typings/globals/es6-promise/index.d.ts deleted file mode 100644 index 2a894e1..0000000 --- a/typings/globals/es6-promise/index.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -// Generated by typings -// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/71c9d2336c0c802f89d530e07563e00b9ac07792/es6-promise/es6-promise.d.ts -interface Thenable { - then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; - then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => void): Thenable; -} - -declare class Promise implements Thenable { - /** - * If you call resolve in the body of the callback passed to the constructor, - * your promise is fulfilled with result object passed to resolve. - * If you call reject your promise is rejected with the object passed to reject. - * For consistency and debugging (eg stack traces), obj should be an instanceof Error. - * Any errors thrown in the constructor callback will be implicitly passed to reject(). - */ - constructor(callback: (resolve : (value?: T | Thenable) => void, reject: (error?: any) => void) => void); - - /** - * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. - * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called. - * Both callbacks have a single parameter , the fulfillment value or rejection reason. - * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve. - * If an error is thrown in the callback, the returned promise rejects with that error. - * - * @param onFulfilled called when/if "promise" resolves - * @param onRejected called when/if "promise" rejects - */ - then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => U | Thenable): Promise; - then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => void): Promise; - - /** - * Sugar for promise.then(undefined, onRejected) - * - * @param onRejected called when/if "promise" rejects - */ - catch(onRejected?: (error: any) => U | Thenable): Promise; -} - -declare namespace Promise { - /** - * Make a new promise from the thenable. - * A thenable is promise-like in as far as it has a "then" method. - */ - function resolve(value?: T | Thenable): Promise; - - /** - * Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error - */ - function reject(error: any): Promise; - function reject(error: T): Promise; - - /** - * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. - * the array passed to all can be a mixture of promise-like objects and other objects. - * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. - */ - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable, T10 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable]): Promise<[T1, T2, T3, T4, T5]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable ]): Promise<[T1, T2, T3, T4]>; - function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable]): Promise<[T1, T2, T3]>; - function all(values: [T1 | Thenable, T2 | Thenable]): Promise<[T1, T2]>; - function all(values: (T | Thenable)[]): Promise; - - /** - * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. - */ - function race(promises: (T | Thenable)[]): Promise; -} - -declare module 'es6-promise' { - var foo: typeof Promise; // Temp variable to reference Promise in local context - namespace rsvp { - export var Promise: typeof foo; - export function polyfill(): void; - } - export = rsvp; -} diff --git a/typings/globals/es6-promise/typings.json b/typings/globals/es6-promise/typings.json deleted file mode 100644 index 341c081..0000000 --- a/typings/globals/es6-promise/typings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "resolution": "main", - "tree": { - "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/71c9d2336c0c802f89d530e07563e00b9ac07792/es6-promise/es6-promise.d.ts", - "raw": "registry:dt/es6-promise#0.0.0+20160614011821", - "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/71c9d2336c0c802f89d530e07563e00b9ac07792/es6-promise/es6-promise.d.ts" - } -} diff --git a/typings/index.d.ts b/typings/index.d.ts index ae69027..c088edd 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1,4 +1,3 @@ -/// /// /// ///