diff --git a/src/vs/base/common/async.ts b/src/vs/base/common/async.ts index d71f98686f333cc529495d47083286481f7732b7..6805a79b334cc55a80c7ac47a7d363cf7d45e8ae 100644 --- a/src/vs/base/common/async.ts +++ b/src/vs/base/common/async.ts @@ -7,47 +7,6 @@ import * as errors from 'vs/base/common/errors'; import { Promise, TPromise, ValueCallback, ErrorCallback, ProgressCallback } from 'vs/base/common/winjs.base'; import * as platform from 'vs/base/common/platform'; -import {CancellationTokenSource} from 'vs/base/common/cancellation'; - -export interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; -} - -export function wrapAsWinJSPromise(callback: (...args: any[]) => PromiseLike, context: any): (...args: any[]) => TPromise { - - if (!callback) { - return; - } - - let result = function(...args: any[]) { - - let source = new CancellationTokenSource(); - - return new TPromise((c, e) => { - - args.push(source.token); - let value = callback.apply(context, args); - - if (value && typeof (>value).then === 'function') { - value.then(c, e); - } else { - c(value); - } - - }, function() { - source.cancel(); - }); - }; - - return result; -} export interface ITask { (): T;