本文整理汇总了TypeScript中vs/base/common/winjs.base.Promise.as方法的典型用法代码示例。如果您正苦于以下问题:TypeScript base.Promise.as方法的具体用法?TypeScript base.Promise.as怎么用?TypeScript base.Promise.as使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/base/common/winjs.base.Promise
的用法示例。
在下文中一共展示了base.Promise.as方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: next
export function sequence<T>(promiseFactory: ITask<TPromise<T>>[]): TPromise<T[]> {
var results: T[] = [];
// Reverse since we start with last element using pop()
promiseFactory = promiseFactory.reverse();
function next(): Promise {
if (promiseFactory.length) {
return promiseFactory.pop()();
}
return null;
}
function thenHandler(result: any): Promise {
if (result) {
results.push(result);
}
var n = next();
if (n) {
return n.then(thenHandler);
}
return TPromise.as(results);
}
return Promise.as(null).then(thenHandler);
}
示例2:
return this.repo.fetch().then(null, (err) => {
if (err.gitErrorCode === GitErrorCodes.NoRemoteRepositorySpecified) {
return Promise.as(null);
}
return Promise.wrapError(err);
}).then(() => this.status());
示例3: commit
public commit(message:string, amend?: boolean, stage?: boolean): TPromise<IRawStatus> {
var promise: Promise = Promise.as(null);
if (stage) {
promise = this.repo.add(null);
}
return promise
.then(() => this.repo.commit(message, stage, amend))
.then(() => this.status());
}
示例4: start
public start(args: env.ICommandLineArguments): Promise {
env.log('Received data from other instance', args);
// Otherwise handle in windows manager
if (!!args.pluginDevelopmentPath) {
windows.manager.openPluginDevelopmentHostWindow({ cli: args });
} else if (args.pathArguments.length === 0 && args.openNewWindow) {
windows.manager.open({ cli: args, forceNewWindow: true, forceEmpty: true });
} else if (args.pathArguments.length === 0) {
windows.manager.focusLastActive(args);
} else {
windows.manager.open({ cli: args, forceNewWindow: !args.openInSameWindow });
}
return Promise.as(null);
}
示例5: timebomb
function timebomb(): Promise {
if (!env.product.expiryDate || Date.now() <= env.product.expiryDate) {
return Promise.as(null);
}
return new Promise((c, e) => {
dialog.showMessageBox({
type: 'warning',
title: env.product.nameLong,
message: nls.localize('expired', "Expired"),
detail: nls.localize('expiredDetail', "This pre-release version of {0} has expired.\n\nPlease visit {1} to download the current release.", env.product.nameLong, env.product.expiryUrl),
buttons: [nls.localize('quit', "Quit"), nls.localize('openWebSite', "Open Web Site")],
noLink: true,
}, (i) => {
if (i === 1) {
shell.openExternal(env.product.expiryUrl);
}
e('Product expired');
});
});
}
示例7: getParent
getParent(tree: ITree, element: any): Promise {
return Promise.as(null);
}
示例8: getChildren
getChildren(tree: ITree, element: any): Promise {
const model = this.modelProvider.getModel();
return Promise.as(model === element ? model.entries : []);
}
示例9:
var factoryFactory = (n: number) => () => {
return Promise.as(n);
};