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


TypeScript dom.makeDOMDriver函數代碼示例

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


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

示例1: startPanel

export function startPanel(graph$: Stream<string>): void {
  const adHocContainer: Element = document.createElement('DIV');
  adHocContainer.id = '#ad-hoc-container';
  document.body.appendChild(adHocContainer);
  const domDriver = makeDOMDriver(
    document.querySelector('#tools-container') || adHocContainer,
  );

  const domSinkProxy = xs.create<VNode>();
  const domSource = domDriver(domSinkProxy, xsSA);

  const panelSources = {graph: graph$, DOM: domSource};
  const panelSinks = Panel(panelSources);

  styles.inject();
  domSinkProxy.imitate(panelSinks.DOM);
  panelSinks.zapSpeed.addListener({
    next(s: ZapSpeed) {
      // alert('PANEL posting message to graph serializer: ' + s);
      window['postMessageToGraphSerializer'](s);
    },
    error(err: any) { },
    complete() { },
  });
}
開發者ID:whitecolor,項目名稱:cyclejs,代碼行數:25,代碼來源:index.ts

示例2: 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

示例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: require

import {test} from '../testsuite';
import {bowlingLineTests} from './bowlingLine/index.spec';
import {makeDOMDriver} from '@cycle/dom';
import {run} from '@cycle/rxjs-run';
import {main} from './main';
import {mainTests} from './main.spec';
require('./styles.css');

test('FRP Bowling Kata', function() {
  test('FRP Bowling Kata Application Mainline', mainTests);
  test('FRP Bowling Kata BowlingLine Component', bowlingLineTests);
});

run(main, {DOM: makeDOMDriver('#app')});
開發者ID:wizardwerdna,項目名稱:FRPBowlingKata,代碼行數:14,代碼來源:app.ts

示例5: div

        transform: `translate(${link.position.x}px, ${link.position.y}px)`
      }
    }, [img({ attrs: { src: link.image }})]))

  return div(vnodes)
}

function main({ time, DOM }) {

  const raf$ = time.animationFrames()

  const pause$ = DOM
    .select("document")
    .events("keyup")
    .filter(event => event.keyCode == 32)
    .fold(acc => !acc, false)

  return {
    DOM: raf$
      .compose(sampleCombine(pause$))
      .filter(([_, paused]) => !paused)
      .fold(updateState, links)
      .map(render)
  }
}

run(main, {
    DOM: makeDOMDriver("#main"),
    time: timeDriver
});
開發者ID:atomrc,項目名稱:find.thomasbelin.fr,代碼行數:30,代碼來源:application.ts

示例6: 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

示例7: 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

示例8: 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

示例9: run

console.clear();
import {Observable} from 'rxjs';
import {run} from '@cycle/rxjs-run';
import {div, input, li, hr, h1, button, b, br, span, ul, label, makeDOMDriver} from '@cycle/dom';
import {makeHTTPDriver} from '@cycle/http';
import * as $ from 'jquery';

run(main, {DOM: makeDOMDriver('#app'), HTTP: makeHTTPDriver()});

function main(sources) {
  const loadButton$ = sources.DOM.select('button').events('click')
    .startWith(null);
  const searchInput$ = sources.DOM.select('#search').events('input');

  const search$ = searchInput$
    .map(evt => evt.target.value)
    .startWith('');

  const request$ = loadButton$
    .mapTo({
      url: eldenStream(),
      method: 'GET',
      headers: {
        'Content-Type': 'application/json; charset=utf-8',
        'Access-Control-Allow-Origin': '*',
      },
      category: 'eldenStream'
    })
    ;

  const products$ = sources.HTTP
開發者ID:wizardwerdna,項目名稱:CycleSimpleFormExample,代碼行數:31,代碼來源:boilerplate.ts

示例10: run

import {makeDOMDriver} from '@cycle/dom';
import {run} from '@cycle/rxjs-run';

import {BOAT_HOST, BOAT_PORT} from '../../constants';
import {Settings} from '../components/Settings';
import {makeUdpDriver} from '../drivers/broadcast';

run(Settings, {
    dom: makeDOMDriver(`#app`),
    wireless$: makeUdpDriver(BOAT_HOST, BOAT_PORT),
});
開發者ID:LakeMaps,項目名稱:hangashore,代碼行數:11,代碼來源:settings.ts


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