當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript xstream-run.run函數代碼示例

本文整理匯總了TypeScript中@cycle/xstream-run.run函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript run函數的具體用法?TypeScript run怎麽用?TypeScript run使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了run函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: run

import main from './main';
import { run } from '@cycle/xstream-run';
import { makeDOMDriver } from '@cycle/dom';

run(main, {
  dom: makeDOMDriver('#app')
});
開發者ID:artfuldev,項目名稱:recall-cycle,代碼行數:7,代碼來源:app.ts

示例2: run

import {run} from '@cycle/xstream-run';
import {makeDOMDriver} from '@cycle/dom';
import { makeHTTPDriver } from '@cycle/http';
import Login from './Login';
// import BmiCalculator from './BmiCalculator';
// const main = BmiCalculator;
const main = Login

run(main, {
  DOM: makeDOMDriver('#main-container'),
  HTTP: makeHTTPDriver()
});
開發者ID:wpcfan,項目名稱:calltalent_web_cyclejs,代碼行數:12,代碼來源:index.ts

示例3: run

import {run} from '@cycle/xstream-run';
import {makeDOMDriver} from '@cycle/dom';
import Counter from './Counter';

const main = Counter;

run(main, {
  DOM: makeDOMDriver('#main-container')
});
開發者ID:mxstbr,項目名稱:cyclejs-counter,代碼行數:9,代碼來源:index.ts

示例4: run

    //       return {
    //         name: s.name,
    //         input
    //       }
    //     }).debug((x: any) => console.log('debug', x)) // Object {name...}
    // ).debug((x: any) => console.log('debug2', x)) // Stream
    // .flatten()
    // .debug((x: any) => console.log('debug3', x)) // nothing
    sendUpdate: xs.combine(
      state$.compose(dropRepeats<Model>((a, b) => a.shows === b.shows)),
      keyboard.filter((x: Input) => x === 'increment' || x === 'decrement')
    )
      .compose(debounce(100))
      .map(([state, input]: [Model, Input]): Update => {
        const s = state.shows[state.cursor];
        return {
          name: s.name,
          count: s.count,
          input
        }
      })
  };
}

run(main, {
  DOM: makeDOMDriver('#app'),
  keyboard: makeKeyboardDriver(),
  scrollIntoView: makeScrollIntoViewDriver(),
  sendUpdate: makeSendUpdateDriver()
});
開發者ID:justinwoo,項目名稱:tracker,代碼行數:30,代碼來源:index.ts

示例5: run

document.addEventListener('DOMContentLoaded', () => run(main, drivers));
開發者ID:sambou,項目名稱:cyclejs-boilerplate,代碼行數:1,代碼來源:index.ts

示例6: makeDOMDriver

      data: { id, label }
    })),
    board.noteDelete$.map(id => ({
      type: 'delete-note',
      data: { id }
    }))
  )

  return {
    DOM: board.DOM,
    websocket: Stream.merge(boardWebsocket$, Stream.of({ type: 'init' }))
      .debug('websocket$'),
    preventDefault: board.preventDefault,
    focus: board.focus,
  }
}

Cycle.run(main, {
  DOM: makeDOMDriver('#root'),
  websocket: createWebsocketDriver('http://localhost:3000'),
  focus: createFocusDriver(),
  preventDefault: (event$: Stream<Event>) => {
    event$.addListener({
      next: (e) => e.preventDefault(),
      error: (err) => console.error(err),
      complete: () => {}
    })
    return {}
  },
})
開發者ID:JamesHageman,項目名稱:xstream-scrumbler,代碼行數:30,代碼來源:index.ts

示例7: main

import xs from "xstream";
import {run} from "@cycle/xstream-run";
import {makeDOMDriver, h1} from "@cycle/dom";



function main() {
	const sinks = {
		DOM: xs.periodic(1000).map(i => h1('' + i + " seconds elapsed"))
	};
  return sinks;
}

const drivers:{[name:string]: Function} = {
	DOM: makeDOMDriver("#app")
}

run(main, drivers);

開發者ID:udondokodoon,項目名稱:touchevents,代碼行數:18,代碼來源:main.ts

示例8: send

    action$: gameAction$ as Stream<Action>
  });

  const stateForClients$ = state$
    .map(state => ({type: 'UPDATE_STATE', data: state}));

  const stateUpdate$ = stateForClients$.map(broadcast);

  const newConnection$ = sources.Socket.connections;

  const newClientState$ = stateForClients$
    .map(state => newConnection$.map(id => send(id, state)))
    .flatten();

  const setClientId$ = newConnection$
    .map(id => send(id, {type: 'SET_ID', data: id}));

  const socket$ = xs.merge(
    stateUpdate$,
    newClientState$,
    setClientId$
  );

  return {
    Socket: socket$
  }
}

server.listen(8000, () => console.log(`Listening on localhost:8000`));
run(Server, drivers);
開發者ID:Widdershin,項目名稱:schism,代碼行數:30,代碼來源:server.ts

示例9: next

    ws.onmessage = (data, flags) => {
      observer.next(JSON.parse(data.data));
    };

    ws.onopen = () => {
      sink$.addListener({
        next (message) {
          console.log('outgoing message', message);
          ws.send(JSON.stringify(message));
        }
      });

      startup.shamefullySendNext('');
    };

    return {
      messages: stream,
      startup
    };
  }
}

const drivers = {
  DOM: makeDOMDriver('.app'),
  Animation: makeAnimationDriver(),
  Socket: makeWebSocketDriver(new WebSocket(`ws://${location.host}/websocket`))
};

run(Client, drivers);

開發者ID:Widdershin,項目名稱:schism,代碼行數:29,代碼來源:client.ts

示例10: h

import xs from 'xstream';
import {run} from '@cycle/xstream-run';
import {makeDOMDriver, h} from '@cycle/dom';

const App = () => ({
  DOM: xs.of(
    h('div.app', [
      h('h1', 'Enter the lairs'),
      h('p', 'Lorem ipsum')
    ])
  )
});

// tslint:disable-next-line:no-expression-statement
run(App, {
  DOM: makeDOMDriver(document.getElementById('app'))
});
開發者ID:cutepig,項目名稱:typescript-cycle-baseline,代碼行數:17,代碼來源:index.ts


注:本文中的@cycle/xstream-run.run函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。