当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Observable.bindCallback方法代码示例

本文整理汇总了TypeScript中rxjs.Observable.bindCallback方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Observable.bindCallback方法的具体用法?TypeScript Observable.bindCallback怎么用?TypeScript Observable.bindCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rxjs.Observable的用法示例。


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

示例1: ngOnInit

  ngOnInit() {
    // initial data for placeholder chart
    this.getSymbols(['CSCO']);

    // hacked csv parsing
    // normally I would create server endpoint that will download, parse, store and serve as JSON
    Observable
      .bindCallback(d3.csv)('nasdaq.csv')
      .subscribe(data => this.store.dispatch(StoreActions.loadSymbols(data[1])));
  }
开发者ID:dszmaj,项目名称:stocks-app,代码行数:10,代码来源:fullList.component.ts

示例2: getPluginPath

import { exec } from 'child_process';
import * as fs from 'fs';
import { join } from 'path';
import { Observable } from 'rxjs';
import { ILogger, IOmnisharpPlugin } from '../enums';
import { createObservable } from '../operators/create';
import { RuntimeContext } from './runtime';

const bootstrappedPlugins = new Map<string, string>();
const exists = Observable.bindCallback(fs.exists);
const readFile: (file: string) => Observable<any> = Observable.bindNodeCallback(fs.readFile);
// tslint:disable-next-line:no-var-requires no-require-imports
const md5: (value: any) => string = require('md5');

// tslint:disable-next-line:export-name
export function getPluginPath(solutionLocation: string, ctx: RuntimeContext, requestedPlugins: IOmnisharpPlugin[], logger: ILogger) {
    const plugins: any[] = [];
    const hashStrings: any[] = [];
    let hash: string;
    requestedPlugins.forEach(plugin => {
        plugins.push(plugin);
    });

    return createObservable<string>(observer => {
        logger.log('Bootstrapping ' + solutionLocation);
        // Include the plugins defined in omnisharp.json, they could have changed.
        exists(join(solutionLocation, 'omnisharp.json'))
            .filter(x => !!x)
            .flatMap(x => readFile(join(solutionLocation, 'omnisharp.json')))
            .map(x => JSON.parse(x.toString()))
            .do({
开发者ID:OmniSharp,项目名称:omnisharp-node-client,代码行数:31,代码来源:plugin.ts


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