How to use the core-js/features/observable function in core-js

To help you get started, we’ve selected a few core-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotFramework-WebChat / packages / core / src / __tests__ / connectSaga.spec.js View on Github external
beforeEach(() => {
  const sagaMiddleware = createSagaMiddleware();

  store = createStore(
    ({ actionTypes = [] } = {}, { type }) =>
      /^DIRECT_LINE\/(DIS|RE)?CONNECT/u.test(type)
        ? // We are only interested in CONNECT_*, RECONNECT_*, and DISCONNECT_* actions.
          { actionTypes: [...actionTypes, type] }
        : { actionTypes },
    applyMiddleware(sagaMiddleware)
  );

  sagaMiddleware.run(connectSaga);

  directLine = {
    activity$: new Observable(() => () => 0),
    connectionStatus$: new Observable(observer => {
      connectionStatusObserver = observer;
      observer.next(0);
    }),
    end: () => 0,
    postActivity: () =>
      new Observable(observer => {
        observer.next({ id: '' });
      })
  };
});
github microsoft / BotFramework-WebChat / packages / core / src / __tests__ / connectSaga.spec.js View on Github external
const sagaMiddleware = createSagaMiddleware();

  store = createStore(
    ({ actionTypes = [] } = {}, { type }) =>
      /^DIRECT_LINE\/(DIS|RE)?CONNECT/u.test(type)
        ? // We are only interested in CONNECT_*, RECONNECT_*, and DISCONNECT_* actions.
          { actionTypes: [...actionTypes, type] }
        : { actionTypes },
    applyMiddleware(sagaMiddleware)
  );

  sagaMiddleware.run(connectSaga);

  directLine = {
    activity$: new Observable(() => () => 0),
    connectionStatus$: new Observable(observer => {
      connectionStatusObserver = observer;
      observer.next(0);
    }),
    end: () => 0,
    postActivity: () =>
      new Observable(observer => {
        observer.next({ id: '' });
      })
  };
});
github microsoft / BotBuilder-Samples / samples / javascript_es6 / 01.browser-echo / src / webChatAdapter.ts View on Github external
constructor() {
        super();

        this.botConnection = {
            connectionStatus$: new Observable(observer => {
                observer.next(ConnectionStatus.Uninitialized);
                observer.next(ConnectionStatus.Connecting);
                observer.next(ConnectionStatus.Online);
            }),
            activity$: new Observable(observer => {
                this.activityObserver = observer;
            }),
            end() {
                // The React component was called to unmount:
                // https://github.com/Microsoft/BotFramework-WebChat/blob/57360e4df92e041d5b0fd4810c1abf96621b5283/src/Chat.tsx#L237-L247
                // Developers will need to decide what behavior the component should implement.
                // For this sample, this.botConnection.componentWillUnmount() and this.botConnection.end()
                // is never called.
                console.log('this.botConnection.componentWillUnmount() called.');
            },
            getSessionId: () => new Observable(observer => observer.complete()),
github microsoft / BotBuilder-Samples / samples / javascript_es6 / 01.browser-echo / src / webChatAdapter.ts View on Github external
constructor() {
        super();

        this.botConnection = {
            connectionStatus$: new Observable(observer => {
                observer.next(ConnectionStatus.Uninitialized);
                observer.next(ConnectionStatus.Connecting);
                observer.next(ConnectionStatus.Online);
            }),
            activity$: new Observable(observer => {
                this.activityObserver = observer;
            }),
            end() {
                // The React component was called to unmount:
                // https://github.com/Microsoft/BotFramework-WebChat/blob/57360e4df92e041d5b0fd4810c1abf96621b5283/src/Chat.tsx#L237-L247
                // Developers will need to decide what behavior the component should implement.
                // For this sample, this.botConnection.componentWillUnmount() and this.botConnection.end()
                // is never called.
                console.log('this.botConnection.componentWillUnmount() called.');
            },
            getSessionId: () => new Observable(observer => observer.complete()),
            postActivity: activity => {
                const id = Date.now().toString();

                return new Observable(observer => {
                    const serverActivity = {