本文整理汇总了TypeScript中bluebird.Promise.resolve方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Promise.resolve方法的具体用法?TypeScript Promise.resolve怎么用?TypeScript Promise.resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bluebird.Promise
的用法示例。
在下文中一共展示了Promise.resolve方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(info: BuildInfo, cleanupTasks: Array<() => Promise<any>>) {
super(info)
const certificateFile = this.platformSpecificBuildOptions.certificateFile
if (certificateFile != null) {
const certificatePassword = this.platformSpecificBuildOptions.certificatePassword || this.getCscPassword()
this.cscInfo = BluebirdPromise.resolve({
file: certificateFile,
password: certificatePassword == null ? null : certificatePassword.trim(),
})
}
else if (this.options.cscLink != null) {
this.cscInfo = downloadCertificate(this.options.cscLink)
.then(path => {
cleanupTasks.push(() => deleteFile(path, true))
return {
file: path,
password: this.getCscPassword(),
}
})
}
else {
this.cscInfo = BluebirdPromise.resolve(null)
}
this.iconPath = this.getValidIconPath()
}
示例2: pack
async pack(outDir: string, arch: string, postAsyncTasks: Array<Promise<any>>): Promise<any> {
if (arch === "ia32") {
warn("For windows consider only distributing 64-bit, see https://github.com/electron-userland/electron-builder/issues/359#issuecomment-214851130")
}
// we must check icon before pack because electron-packager uses icon and it leads to cryptic error message "spawn wine ENOENT"
await this.iconPath
const appOutDir = this.computeAppOutDir(outDir, arch)
const packOptions = this.computePackOptions(outDir, appOutDir, arch)
if (!this.options.dist) {
await this.doPack(packOptions, outDir, appOutDir, arch, this.customBuildOptions)
return
}
const installerOut = this.options.dist ? computeDistOut(outDir, arch) : null
await BluebirdPromise.all([
this.packApp(packOptions, appOutDir),
installerOut == null ? BluebirdPromise.resolve() : emptyDir(installerOut)
])
await this.copyExtraResources(appOutDir, arch, this.customBuildOptions)
if (this.options.dist) {
postAsyncTasks.push(this.packageInDistributableFormat(outDir, appOutDir, installerOut!, arch, packOptions))
}
}
示例3: assertThat
packed: () => {
assertThat(platformPackager.effectiveSignOptions).has.properties({
entitlements: "osx-entitlements file path",
"entitlements-inherit": "osx-entitlementsInherit file path",
})
return BluebirdPromise.resolve(null)
}
示例4: deleteOldElectronVersion
function deleteOldElectronVersion(): Promise<any> {
if (process.env.CI) {
const cacheDir = path.join(require("os").homedir(), ".electron")
return fs.readdir(cacheDir)
.catch(error => {
if (error.code === "ENOENT") {
return []
}
else {
throw error
}
})
.then(it => {
const deletePromises: Array<Promise<any>> = []
for (let file of it) {
if (file.endsWith(".zip") && !file.includes(electronVersion)) {
console.log("Remove old electron " + file)
deletePromises.push(fs.unlink(path.join(cacheDir, file)))
}
}
return BluebirdPromise.all(deletePromises)
})
}
else {
return BluebirdPromise.resolve()
}
}
示例5: constructor
constructor(private packager: WinPackager, private outDir: string, private appOutDir: string) {
if (process.env.USE_SYSTEM_MAKENSIS) {
this.nsisPath = BluebirdPromise.resolve("makensis")
}
else {
this.nsisPath = getBin("nsis", `nsis-${NSIS_VERSION}`, `https://dl.bintray.com/electron-userland/bin/nsis-${NSIS_VERSION}.7z`, NSIS_SHA2)
}
this.nsisOptions = packager.info.devMetadata.build.nsis || Object.create(null)
}
示例6: constructor
constructor(info: BuildInfo, cleanupTasks: Array<() => Promise<any>>) {
super(info)
if (this.options.cscLink != null && this.options.cscKeyPassword != null) {
const keychainName = generateKeychainName()
cleanupTasks.push(() => deleteKeychain(keychainName))
this.codeSigningInfo = createKeychain(keychainName, this.options.cscLink, this.options.cscKeyPassword, this.options.csaLink)
}
else {
this.codeSigningInfo = BluebirdPromise.resolve(null)
}
}
示例7: signMac
private signMac(distPath: string, codeSigningInfo: CodeSigningInfo): Promise<any> {
if (codeSigningInfo == null) {
codeSigningInfo = {cscName: this.options.sign || process.env.CSC_NAME}
}
if (codeSigningInfo.cscName == null) {
log("App is not signed: CSC_LINK or CSC_NAME are not specified")
return BluebirdPromise.resolve()
}
else {
log("Signing app")
return sign(distPath, codeSigningInfo)
}
}
示例8: constructor
constructor(info: BuildInfo, cleanupTasks: Array<() => Promise<any>>) {
super(info)
// https://developer.mozilla.org/en-US/docs/Signing_an_executable_with_Authenticode
// https://github.com/Squirrel/Squirrel.Windows/pull/505
if (this.options.cscLink != null && this.options.cscKeyPassword != null && process.platform !== "darwin") {
this.certFilePromise = downloadCertificate(this.options.cscLink)
.then(path => {
cleanupTasks.push(() => deleteFile(path, true))
return path
})
}
else {
this.certFilePromise = BluebirdPromise.resolve(null)
}
}
示例9: constructor
constructor(info: BuildInfo, cleanupTasks: Array<() => Promise<any>>) {
super(info)
if (this.options.cscLink != null && this.options.cscKeyPassword != null) {
this.certFilePromise = downloadCertificate(this.options.cscLink)
.then(path => {
cleanupTasks.push(() => deleteFile(path, true))
return path
})
}
else {
this.certFilePromise = BluebirdPromise.resolve(null)
}
this.iconPath = this.getValidIconPath()
}