• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript bluebird.all函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中bluebird.all函数的典型用法代码示例。如果您正苦于以下问题:TypeScript all函数的具体用法?TypeScript all怎么用?TypeScript all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了all函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: createBuildDirectory

export async function createBuildDirectory(buildDirectory: string, templateDirectory: string, assets: string[]) {

    // read directory
    const files = await readDir(templateDirectory);
    await Bluebird.all(files

        // ignore *.mustache templates
        .filter(file => path.extname(file) !== '.mustache')

        // copy recursive
        .map(file => copyAll(
            path.resolve(templateDirectory, file),
            path.resolve(buildDirectory, file),
        ))
    );

    // create assets directory
    await mkDir(path.resolve(buildDirectory, 'assets'));

    await Bluebird.all(assets
        .map(asset => copyAll(
            asset,
            path.resolve(buildDirectory, 'assets', path.basename(asset))
        ))
    );
}
开发者ID:2fd,项目名称:graphdoc,代码行数:26,代码来源:fs.ts


示例2: it

    it('GET will not return the tribe if a player had that email but had it removed.', async function () {
        let tribe = {id: 'delete-me', name: 'tribe-from-endpoint-tests'};
        let playerId = monk.id();
        await Bluebird.all([
            host.post(path).send(tribe),
            host.post(path + '/players').send({
                _id: playerId,
                name: 'delete-me',
                tribe: 'delete-me',
                email: userEmail + '._temp'
            })
        ]);

        await authorizeUserForTribes([]);

        await host.post(path + '/players').send({
            _id: playerId,
            name: 'delete-me',
            tribe: 'delete-me',
            email: 'something else '
        });

        const response = await host.get(path)
            .expect(200)
            .expect('Content-Type', /json/);
        expect(clean(response.body)).toEqual(clean([]));

        await Bluebird.all([
            tribesCollection.remove({id: 'delete-me'}, false),
            playersCollection.remove({_id: playerId})
        ]);
    });
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:32,代码来源:tribes-spec.ts


示例3: updatePhotos

export function updatePhotos(photos: PhotoType[], update: Partial<PhotoType>) {
    let updatePhotoWorkPromise = null
    if (update.hasOwnProperty('flag')) {
        updatePhotoWorkPromise = Promise.all(photos.map(photo =>
            updatePhotoWork(
                photo,
                photoWork => {
                    if (update.flag) {
                        photoWork.flagged = true
                    } else {
                        delete photoWork.flagged
                    }
                })
        ))
    }

    const photoIds = photos.map(photo => photo.id)
    Promise.all([
        updatePhotoWorkPromise,
        updatePhotosInDb(photoIds, update)
    ])
    .then(() => {
        const changedPhotos = photos.map(photo => ({ ...photo, ...update } as PhotoType))
        store.dispatch(changePhotosAction(changedPhotos, update))
    })
    .catch(error => {
        // TODO: Show error in UI
        console.error('Updating photos failed', error)
    })
}
开发者ID:m0g,项目名称:ansel,代码行数:30,代码来源:PhotoController.ts


示例4: getAll

    getAll(keys: K[]): Promise<any[]> {
        var partitionService = this.client.getPartitionService();
        var partitionsToKeys: {[id: string]: any} = {};
        var key: K;
        for (var i in keys) {
            key = keys[i];
            var keyData = this.toData(key);
            var pId: number = partitionService.getPartitionId(keyData);
            if (!partitionsToKeys[pId]) {
                partitionsToKeys[pId] = [];
            }
            partitionsToKeys[pId].push(keyData);
        }

        var partitionPromises: Promise<[Data, Data][]>[] = [];
        for (var partition in partitionsToKeys) {
            partitionPromises.push(this.encodeInvokeOnPartition<[Data, Data][]>(
                MapGetAllCodec,
                Number(partition),
                partitionsToKeys[partition])
            );
        }
        var toObject = this.toObject.bind(this);
        var deserializeEntry = function(entry: [Data, Data]) {
            return [toObject(entry[0]), toObject(entry[1])];
        };
        return Promise.all(partitionPromises).then(function(serializedEntryArrayArray: [Data, Data][][]) {
            return Array.prototype.concat.apply([], serializedEntryArrayArray).map(deserializeEntry);
        });
    }
开发者ID:oguzdemir,项目名称:hazelcast-nodejs-client,代码行数:30,代码来源:MapProxy.ts


示例5: process

 /**
  * process `messages` with registered processes
  */
 process(files: string[], executeFile: (filePath: string) => Promise<TextlintResult>): Promise<TextlintResult[]> {
     const unExecutedResults: Array<Promise<TextlintResult>> = [];
     const resultPromises = files
         .filter(filePath => {
             const shouldExecute = this._backers.every(backer => {
                 return backer.shouldExecute({ filePath });
             });
             // add fake unExecutedResults for un-executed file.
             if (!shouldExecute) {
                 unExecutedResults.push(this._createFakeResult(filePath));
             }
             return shouldExecute;
         })
         .map(filePath => {
             return executeFile(filePath).then(result => {
                 this._backers.forEach(backer => {
                     backer.didExecute({ result });
                 });
                 return result;
             });
         })
         .concat(unExecutedResults);
     // wait all resolved, and call afterAll
     return Promise.all(resultPromises).then((results: (TextlintResult)[]) => {
         this._backers.forEach(backer => {
             backer.afterAll();
         });
         return results;
     });
 }
开发者ID:textlint,项目名称:textlint,代码行数:33,代码来源:execute-file-backer-manager.ts


示例6: writeFile

 .then(details => promise
     .all([
         writeFile(`${details.slidePath}/${details.slideName}.component.ts`, componentTemplate(details)),
         writeFile(`${details.slidePath}/${details.slideName}.component.html`, htmlTemplate(details)),
         writeFile(`${details.slidePath}/${details.slideName}.component.scss`, scssTemplate(details)),
     ])
     .then(() => details)
开发者ID:dfbaskin,项目名称:angular2-overview,代码行数:7,代码来源:add-slide.ts


示例7: Promise

                    return new Promise((resolve, reject) => {
                        try {
                            if (fs.readFileSync(wifi.configFiles.hostapdConf.path).toString().indexOf('# wifi-setup config') === -1) {
                                Utils.backupFile(wifi.configFiles.hostapdConf.path);
                            }
                        } catch (e) {}

                        let getHostapdFile = new Promise((resolve, reject) => {
                            fs.readFile(`${__dirname}/hostapd.conf.fill`, (err, file) => {
                                if (err) {
                                    reject(err);
                                } else {
                                    resolve(file);
                                }
                            });
                        });
                        Promise.all([getHostapdFile, wifi.getDriver()]).then((results) => {
                            let file = results[0];
                            // let driver = results[1] || 'rtl871xdrv';
                            let driver = 'rtl871xdrv';

                            var hostapdConf = file.toString();
                            hostapdConf = Utils.replaceAll(hostapdConf, '{{SSID}}', SSID);
                            hostapdConf = Utils.replaceAll(hostapdConf, '{{password}}', password);
                            hostapdConf = Utils.replaceAll(hostapdConf, '{{driver}}', driver);
                            fs.writeFile(wifi.configFiles.hostapdConf.path, hostapdConf, (err) => {
                                if (err) {
                                    reject(err);
                                } else {
                                    resolve();
                                }
                            });
                        });
                    });
开发者ID:dudeofawesome,项目名称:wifi-setup,代码行数:34,代码来源:wifi-manager.ts


示例8:

 .then(function() {
   console.log("THEN");
   return Promise.all([
     client.createReceiver('fhir_datasync_queue_dev', { auto_delete: true })
     //client.createSender('fhir_datasync_queue_dev')
   ]);
 })
开发者ID:truedeity,项目名称:nodechat,代码行数:7,代码来源:amqp10server.ts


示例9: refresh

export function refresh() {
    // set the history panel to false and remove the class that show the button history active when refresh
    $gitPanel.find(".git-history-toggle").removeClass("active").attr("title", Strings.TOOLTIP_SHOW_HISTORY);
    $gitPanel.find(".git-file-history").removeClass("active").attr("title", Strings.TOOLTIP_SHOW_FILE_HISTORY);

    if (gitPanelMode === "not-repo") {
        $tableContainer.empty();
        return Promise.resolve();
    }

    $tableContainer.find("#git-history-list").remove();
    $tableContainer.find(".git-edited-list").show();

    const p1 = Git.status().catch((err) => {
        // this is an expected "error"
        if (ErrorHandler.contains(err, "Not a git repository")) {
            return;
        }
        throw err;
    });

    const p2 = refreshCommitCounts();

    // Clone button
    $gitPanel.find(".git-clone").prop("disabled", false);

    // FUTURE: who listens for this?
    return Promise.all([p1, p2]);
}
开发者ID:MarcelGerber,项目名称:brackets-git,代码行数:29,代码来源:Panel.ts


示例10: it

    it('when there are multiple connections, gives you the total connection count for the current tribe', function (done) {
        Bluebird.all([
            this.promiseWebsocket(tribeA.id),
            this.promiseWebsocket(tribeB.id),
        ])
            .then(bundles => Bluebird.all(bundles.concat([
                this.promiseWebsocket(tribeA.id),
                this.promiseWebsocket(tribeB.id),
                this.promiseWebsocket(tribeB.id),
            ])))
            .then(bundles => Bluebird.all(bundles.concat([
                this.promiseWebsocket(tribeC.id),
                this.promiseWebsocket(tribeB.id),
            ])))
            .then(bundles => {
                const lastTribeAConnection = bundles[2];
                expect(lastTribeAConnection.messages).toEqual([makeConnectionMessage(2)]);

                const lastTribeBConnection = bundles[bundles.length - 1];
                expect(lastTribeBConnection.messages).toEqual([makeConnectionMessage(4)]);

                const lastTribeCConnection = bundles[5];
                expect(lastTribeCConnection.messages).toEqual([makeConnectionMessage(1)]);

                return bundles;
            })
            .then(closeAllSockets())
            .then(done, done.fail);
    });
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:29,代码来源:websocket-spec.ts



注:本文中的bluebird.all函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript bluebird.attempt函数代码示例发布时间:2022-05-25
下一篇:
TypeScript blue-tape.default函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap