How to use the baconjs.fromEventTarget function in baconjs

To help you get started, we’ve selected a few baconjs 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 CleverCloud / wadl-client / spec / test-server.js View on Github external
textBody(req, function(err, body) {
    s_closed[body] = Bacon.fromEventTarget(res, "close").map(true).toProperty(false);
    s_closed[body].onValue();
  });
});
github ahomu / Talkie / src / control.js View on Github external
touchend(el) {
    return Bacon.fromEventTarget(el, 'touchend');
  },
github ahomu / Talkie / src / control.js View on Github external
click(el) {
    return Bacon.fromEventTarget(el, 'click');
  },
github ahomu / Talkie / src / control.js View on Github external
'use strict';

import Bacon   from 'baconjs';
import keycode from 'keycode';

const EVENT_KEYUP = Bacon.fromEventTarget(document, 'keyup');
const EVENT_KEYDOWN = Bacon.fromEventTarget(document, 'keydown');

/**
 * create EventStream from user input
 */
export default {
  /**
   * @param {String|Number} charKey
   * @returns {EventStream}
   */
  key(charKey) {
    let keyCode = typeof charKey === 'string' ? keycode(charKey)
                                              : charKey;
    return EVENT_KEYUP.filter(keyCodeIs(keyCode));
  },

  /**
github ahomu / Talkie / src / control.js View on Github external
mousemove(el = document.body) {
    return Bacon.fromEventTarget(el, 'mousemove');
  },
github ahomu / Talkie / src / control.js View on Github external
resize() {
    return Bacon.fromEventTarget(window, 'resize');
  },
github ahomu / Talkie / src / ratio.js View on Github external
function resizeEventStream() {
  return Bacon.fromEventTarget(window, 'resize').debounce(250);
}
github ahomu / Talkie / src / control.js View on Github external
'use strict';

import Bacon   from 'baconjs';
import keycode from 'keycode';

const EVENT_KEYUP = Bacon.fromEventTarget(document, 'keyup');
const EVENT_KEYDOWN = Bacon.fromEventTarget(document, 'keydown');

/**
 * create EventStream from user input
 */
export default {
  /**
   * @param {String|Number} charKey
   * @returns {EventStream}
   */
  key(charKey) {
    let keyCode = typeof charKey === 'string' ? keycode(charKey)
                                              : charKey;
    return EVENT_KEYUP.filter(keyCodeIs(keyCode));
  },
github ahomu / Talkie / src / control.js View on Github external
touchmove(el) {
    return Bacon.fromEventTarget(el, 'touchmove');
  },