How to use the rx-lite.Rx function in rx-lite

To help you get started, we’ve selected a few rx-lite 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 jahan-addison / gridpaste / application / src / subscriptions / zoom.js View on Github external
var command    = require('../events/run'),
Rx             = require('rx-lite').Rx;

module.exports = function(App, board) {
  var $zoomSources      = $('.zoom.in, .zoom.out');
  var $zoomSource       = Rx.Observable.fromEvent($zoomSources, "click");

  // Filter when the application is 'off'
  $zoomSource = $zoomSource.filter(function() {
    return !$('#application').hasClass('off');
  });

  var $zoomSubscription = $zoomSource.subscribe(function(e) {
    var target          = $(e.target),
        targetCommand = target.hasClass('in') ? 'zoomIn' : 'zoomOut';
    if ((targetCommand == 'zoomIn'  && board.zoomX < 5.9) ||
        (targetCommand == 'zoomOut' && board.zoomX > 0.167)) {
      var $command  = {
github jahan-addison / gridpaste / application / src / subscriptions / function.js View on Github external
var command    = require('../events/run'),
    Parser     = require('../board/functions/parser'),
    Rx         = require('rx-lite').Rx;

module.exports = function(App) {
  var $sources = $('.function'),
      $source  = Rx.Observable.fromEvent($sources, "keypress");
  // Filter when the application is 'off'
  $source      = $source.filter(function() {
    return !$('#application').hasClass('off');
  });
  var $functionSubscription = $source.subscribe(function(e) {
    if (e.keyCode == 13) {
      var func = new Parser(e.target.value);
      try {
        func.run(); // generate parse tree
      } catch(e) {
        // syntax error
        alert("Syntax: " + e.message);
github jahan-addison / gridpaste / application / src / subscriptions / board.js View on Github external
var command    = require('../events/run'),
    slider     = require('../helper/slider'),
    validate   = require('../helper/validate')(),
    Rx         = require('rx-lite').Rx;

module.exports = function(App) {
  /**
    Pre-queries
   */
  var $querySources  = $([
    '.circle',   '  .angle',   '.arc',
    '.ellipse',    '.segment', '.line',
     '.polygon',   '.point',   '.text',
     '.rotate',    '.reflect', '.shear',
     '.translate', '.scale',   '.delete_'
  ].join(','));
  // The query observer prepares the way for the following operations subscription
  var $querySource       = Rx.Observable.fromEvent($querySources, 'click');
  // Filter queries when the application is 'off'
  $querySource           = $querySource.filter(function() {