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


TypeScript Observable.bindCallback方法代码示例

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


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

示例1: login

 login(): Observable<boolean> {
   Observable.bindCallback(
     PDK.login.bind(PDK, {scope: 'read_public, write_public, read_relationships'}),
     (response: any) => response.session)()
     .subscribe(() => this.broadcastLoggedIn());
   return this.loggedIn$;
 }
开发者ID:cyk,项目名称:pin-head,代码行数:7,代码来源:pinterest.service.ts

示例2: repin

  repin(pin: any, board: any): Observable<Object> {
    let url = board.url.split('/').slice(-3, -1).join('/');

    let data = {
      board: url,
      note: pin.note,
      link: pin.link,
      image_url: pin.image.original.url
    };
    return Observable.bindCallback(
      PDK.request.bind(PDK, '/pins/', 'POST', data),
      (response: any) => response.data
    )();
  }
开发者ID:cyk,项目名称:pin-head,代码行数:14,代码来源:pinterest.service.ts

示例3: performAjaxRequest

 private performAjaxRequest(url, requestData): Observable<any> {
     return Observable.bindCallback((onSuccess: any) => {
         $.ajax({
             url: url,
             type: 'POST',
             data: requestData,
             cache: false,
             contentType: false,
             processData: false,
             success: (data, textStatus, jqXHR) => onSuccess(JSON.parse(data)),
             error: function(jqXHR, textStatus, errorThrown)
             {
                 console.log('ERRORS: ' + textStatus);
                 onSuccess(textStatus);
             }
         });
     })();
 }
开发者ID:Le0Michine,项目名称:Messanger,代码行数:18,代码来源:file-upload.service.ts

示例4: speakObservable

            const capabilities = {
                type: 'ClientCapabilities',
                requiresBotState: true,
                supportsTts: true,
                supportsListening: true
                // Todo: consider implementing acknowledgesTts: true
            };
            (activity as any).entities = (activity as any).entities == null ? [capabilities] :  [...(activity as any).entities, capabilities];
        }

        return state.connection.botConnection.postActivity(activity)
        .map(id => ({ type: 'Send_Message_Succeed', clientActivityId, id } as HistoryAction))
        .catch(error => Observable.of({ type: 'Send_Message_Fail', clientActivityId } as HistoryAction));
    });

const speakObservable = Observable.bindCallback<string, string, {}, {}>(Speech.SpeechSynthesizer.speak);

const speakSSMLEpic: Epic<ChatActions, ChatState> = (action$, store) =>
    action$.ofType('Speak_SSML')
    .filter(action => action.ssml )
    .mergeMap(action => {

        let onSpeakingStarted = null;
        let onSpeakingFinished = () => nullAction;
        if (action.autoListenAfterSpeak) {
            onSpeakingStarted = () => Speech.SpeechRecognizer.warmup() ;
            onSpeakingFinished = () => ({ type: 'Listening_Starting' } as ShellAction);
        }

        const call$ = speakObservable(action.ssml, action.locale, onSpeakingStarted);
        return call$.map(onSpeakingFinished)
开发者ID:alfumit,项目名称:BotFramework-WebChat,代码行数:31,代码来源:Store.ts

示例5: pins

 pins(board: any): Observable<Object> {
   return Observable.bindCallback(
     PDK.request.bind(PDK, `/boards/${board.id}/pins/`, {fields: 'id,note,link,image'}),
     (response: any) => response.data
   )().concatAll();
 }
开发者ID:cyk,项目名称:pin-head,代码行数:6,代码来源:pinterest.service.ts

示例6: followedBoards

 followedBoards(): Observable<any[]> {
   return Observable.bindCallback(
     PDK.me.bind(PDK, 'following/boards', {fields:'id,description,name,image'}),
     (response: any) => response.data
   )();
 }
开发者ID:cyk,项目名称:pin-head,代码行数:6,代码来源:pinterest.service.ts

示例7: logout

 logout(): Observable<boolean> {
   Observable.bindCallback(PDK.logout.bind(PDK))()
   .subscribe(() => this.broadcastLoggedIn());
   return this.loggedIn$;
 }
开发者ID:cyk,项目名称:pin-head,代码行数:5,代码来源:pinterest.service.ts

示例8: snap

 snap(): Observable<string> {
   return Observable.bindCallback(
     Webcam.snap.bind(Webcam),
     (dataUri: string) => dataUri.replace('data:image/jpeg;base64,', '')
   )();
 }
开发者ID:cyk,项目名称:pin-head,代码行数:6,代码来源:webcam.service.ts

示例9:

import { Observable } from 'rxjs/Observable';
// Webpack doesn't bundle correctly without this. TODO: figure out why & fix.
import 'rxjs/add/observable/bindNodeCallback';
import 'rxjs/add/observable/bindCallback';

export interface SocketOptions {
  event: string;
  payload?: any;
}

const emit = Observable.bindNodeCallback((options: SocketOptions, callback: (err: Error, data: any) => void) => {
  window.socket.emit(options.event, options.payload || {}, callback);
});

const on = Observable.bindCallback((options: SocketOptions, callback: (data: any) => void) => {
  window.socket.on(options.event, callback);
});

export const Socket = {
  emit,
  on
};

export interface HttpOptions {
  url: string;
  payload?: any;
}

const get = Observable.bindNodeCallback((url: string, callback: (data: any) => void) => {
  window.ajaxify.loadData(url, callback);
});
开发者ID:WhateverSkynet,项目名称:nodebb-plugin-moonlight,代码行数:31,代码来源:helpers.ts


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