### RxPY Resources Source: https://github.com/reactivex/reactivex.github.io/blob/develop/tutorials.markdown Getting started guide for RxPY, the Python implementation of Reactive Extensions. ```APIDOC RxPY: - Getting Started with RxPY: https://github.com/ReactiveX/RxPY/blob/develop/notebooks/Getting%20Started.ipynb ``` -------------------------------- ### Run the Development Server Source: https://github.com/reactivex/reactivex.github.io/blob/develop/README.md Compiles styles and starts the Jekyll development server. This command assumes that the necessary Ruby gems and Node.js packages have already been installed. ```bash rake ``` -------------------------------- ### Install Development Tools Source: https://github.com/reactivex/reactivex.github.io/blob/develop/README.md Installs necessary tools for building the ReactiveX website. Jekyll is the static site generator, while Uglifier, Rake, and LESS are used for asset compilation. ```ruby gem install jekyll uglifier rake ``` ```javascript npm install -g less ``` -------------------------------- ### Getting Started with ReactiveX on Android Source: https://github.com/reactivex/reactivex.github.io/blob/develop/tutorials.markdown A tutorial to help developers begin using ReactiveX on the Android platform. ```Java Getting Started With ReactiveX on Android: http://code.tutsplus.com/tutorials/getting-started-with-reactivex-on-android--cms-24387 ``` -------------------------------- ### JavaScript Prompt and Eval Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/js/goog/demos/xpc/inner.html A simple JavaScript example that uses the `prompt` function to get user input and `eval` to execute it. This demonstrates basic browser interaction and code execution. ```javascript var code = ''; function evalPrompt() { code = prompt('eval:', code); eval(code); }; // To trigger this, you would typically call evalPrompt() from a button click or similar event. ``` -------------------------------- ### Tracer Management: Unstopped Tracers Source: https://github.com/reactivex/reactivex.github.io/blob/develop/js/goog/demos/tracer.html Demonstrates the issue of unstopped tracers. This function starts tracers but conditionally stops them, highlighting the importance of ensuring all started tracers are eventually stopped to get accurate profiling results. ```javascript function unstoppedTracers() { goog.debug.Trace.initCurrentTrace(0); var tracer = goog.debug.Trace.startTracer('Outer Loop'); var sum = 0; for (var i = 0; i < 10; i++) { var t2 = goog.debug.Trace.startTracer('Run ' + i); if (i != 5) { goog.debug.Trace.stopTracer(t2); } } goog.debug.Trace.stopTracer(tracer); var s = goog.debug.Trace.toString(); var outputElt = document.getElementById('output'); outputElt.innerHTML = goog.string.whitespaceEscape( goog.string.htmlEscape(s)); } unstoppedTracers(); ``` -------------------------------- ### Transition and Overlay Setup Source: https://github.com/reactivex/reactivex.github.io/blob/develop/polymer/components/core-overlay/core-overlay.html Retrieves the transition object associated with the overlay and performs initial setup tasks, including setting the overlay's display and position styles. ```javascript getTransition: function() { return this.meta.byId(this.transition); }, // Initial setup logic when the overlay is first configured __overlaySetup: true, this.target.style.display = null; var transition = this.getTransition(); if (transition) { transition.setup(this.target); } var computed = getComputedStyle(this.target); this.targetStyle = { position: computed.position === 'static' ? 'fixed' : computed.position } if (!transition) { this.target.style.position = this.targetStyle.position; this.target.style.outline = 'none'; } this.target.style.display = 'none'; ``` -------------------------------- ### Learning RxJava for Android by Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/tutorials.markdown Video and code samples for learning RxJava on Android through practical examples. ```Java Learning RxJava (for Android) by example: https://newcircle.com/s/post/1744/2015/06/29/learning-rxjava-for-android-by-example Associated GitHub repository: https://github.com/kaushikgopal/RxJava-Android-Samples ``` -------------------------------- ### RxPHP start Operator Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/pt-br/operators/start.html Illustrates the usage of the start operator in RxPHP, which is equivalent to RxJS's startAsync. This example shows how to create an observable from a function that returns a value and subscribe to it. ```php $source = Rx\Observable::start(function () { return 42; }); $source->subscribe($stdoutObserver); ``` -------------------------------- ### goog.async.Delay Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/js/goog/demos/timers.html Demonstrates how to use goog.async.Delay to invoke an action after a specified delay. It includes functions to start, reset, and handle the delayed action, along with utility functions for getting time values and converting seconds to milliseconds. ```javascript var getSeconds = function (id) { var time = Number(goog.dom.getElement(id).value); if (isNaN(time)) { alert('Please enter a Number'); return null; } else { return time; } }; var inMs = function (seconds) { return seconds * 1000; }; var delay = null; var delayStatus = goog.dom.getElement('delayStatus'); var doDelay = function() { if (delay) { goog.dom.setTextContent(delayStatus, 'Delay already set.'); return; } var seconds = getSeconds('delaySeconds'); if (!goog.isNumber(seconds)) { return; } delay = new goog.async.Delay(delayedAction, inMs(seconds)); delay.start(); goog.dom.setTextContent(delayStatus, 'Delay for: ' + seconds + ' seconds.'); }; var doReset = function(){ if (!delay) { return; } goog.dom.setTextContent(delayStatus, 'Delay Restarted.'); delay.start(); }; var delayedAction = function() { goog.dom.setTextContent(delayStatus, 'Action called.'); delay.dispose(); delay = null; }; ``` -------------------------------- ### RxPHP shareValue Operator Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/ko/operators/refcount.html Demonstrates the shareValue operator in RxPHP, which is similar to share but starts with an initial value. This example shows how an observable with an interval and a side effect is shared among subscribers, with the initial value being emitted immediately to all subscribers before the interval starts. The side effect is executed only once. ```php $loop = \React\EventLoop\Factory::create(); $scheduler = new \Rx\Scheduler\EventLoopScheduler($loop); $source = \Rx\Observable::interval(1000, $scheduler) ->take(2) ->doOnNext(function ($x) { echo "Side effect\n"; }); $published = $source->shareValue(42); $published->subscribe($createStdoutObserver('SourceA ')); $published->subscribe($createStdoutObserver('SourceB ')); $loop->run(); ``` -------------------------------- ### Build and Run with Docker Source: https://github.com/reactivex/reactivex.github.io/blob/develop/README.md Builds a Docker image for the ReactiveX website and runs it, mapping port 4000. This is an optional but convenient way to set up the development environment. ```bash docker build -t reactivex.io - < Dockerfile && docker run -p 4000:4000 -it --rm -v $PWD:/app -t reactivex.io ``` -------------------------------- ### RxPHP shareValue Operator Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/id/operators/refcount.html Demonstrates the shareValue operator in RxPHP, which is similar to share but starts with an initial value. This example shows how an observable with an interval and a side effect is shared among subscribers, with the initial value being emitted immediately to all subscribers before the interval starts. The side effect is executed only once. ```php $loop = \React\EventLoop\Factory::create(); $scheduler = new \Rx\Scheduler\EventLoopScheduler($loop); $source = \Rx\Observable::interval(1000, $scheduler) ->take(2) ->doOnNext(function ($x) { echo "Side effect\n"; }); $published = $source->shareValue(42); $published->subscribe($createStdoutObserver('SourceA ')); $published->subscribe($createStdoutObserver('SourceB ')); $loop->run(); ``` -------------------------------- ### RxJS start Operator Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/operators/start.html The RxJS `start` operator executes a function asynchronously and emits its return value. It can accept a context and a scheduler for execution. The example demonstrates subscribing to an observable created with `start`. ```JavaScript var context = { value: 42 }; var source = Rx.Observable.start( function () { return this.value; }, context, Rx.Scheduler.timeout ); var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); }); ``` -------------------------------- ### Rx.NET Resources Source: https://github.com/reactivex/reactivex.github.io/blob/develop/tutorials.markdown Links to documentation, videos, and articles related to Reactive Extensions for .NET. ```APIDOC Rx.NET: - rx.codeplex.com: https://rx.codeplex.com - Channel 9 MSDN videos on Reactive Extensions: https://channel9.msdn.com/Tags/reactive+extensions - Rx Workshop: Observables vs. Events: https://channel9.msdn.com/Series/Rx-Workshop/Rx-Workshop-Observables-versus-Events - Rx Workshop: Unified Programming Model: https://channel9.msdn.com/Series/Rx-Workshop/Rx-Workshop-Unified-Programming-Model - Improving the Carnac Codebase and Rx Usage: http://jake.ginnivan.net/blog/carnac-improvements/part-1/ - .NET Rocks #907: http://dotnetrocks.com/default.aspx?showNum=907 - Event stream manipulation using Rx (part 1 & 2): https://blogs.endjin.com/2014/04/event-stream-manipulation-using-rx-part-1/, https://blogs.endjin.com/2014/05/event-stream-manipulation-using-rx-part-2/ - Cloud-Scale Event Processing with the Reactive Extensions: https://vimeo.com/132192255 ``` -------------------------------- ### RxJS start Operator Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/cn/operators/start.html The RxJS `start` operator executes a function asynchronously and emits its return value. It can accept a context and a scheduler for execution. The example demonstrates subscribing to an observable created with `start`. ```JavaScript var context = { value: 42 }; var source = Rx.Observable.start( function () { return this.value; }, context, Rx.Scheduler.timeout ); var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); }); ``` -------------------------------- ### Reactive Extensions Presentations and Videos Source: https://github.com/reactivex/reactivex.github.io/blob/develop/tutorials.markdown A collection of presentations and video resources covering Reactive Extensions concepts and applications. ```APIDOC Don’t Cross the Streams - Cascadia.js 2012: slides/demos: http://www.slideshare.net/mattpodwysocki/cascadiajs-dont-cross-the-streams | video: http://www.youtube.com/watch?v=FqBq4uoiG0M Curing Your Asynchronous Blues - Strange Loop 2013: slides/demos: https://github.com/Reactive-Extensions/StrangeLoop2013 | video: http://www.infoq.com/presentations/rx-event-processing Streaming and event-based programming using FRP and RxJS - FutureJS 2014: slides/demos: https://github.com/Reactive-Extensions/FutureJS | video: https://www.youtube.com/watch?v=zlERo_JMGCw MIX 2011: http://channel9.msdn.com/events/MIX/MIX11/HTM07 Reactive Extensions Videos on Channel 9: http://channel9.msdn.com/Tags/reactive+extensions Reactive Angular - Devoxx France 2014 - Martin Gontovnikas: https://www.youtube.com/watch?v=q_WdJguyRrg Testing Reactive Applications: https://speakerdeck.com/benjchristensen/applying-rxjava-to-existing-applications-at-philly-ete-2015 ``` -------------------------------- ### RxPHP shareValue Operator Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/pt-br/operators/refcount.html Demonstrates the shareValue operator in RxPHP, which is similar to share but starts with an initial value. This example shows how an observable with an interval and a side effect is shared among subscribers, with the initial value being emitted immediately to all subscribers before the interval starts. The side effect is executed only once. ```php $loop = \React\EventLoop\Factory::create(); $scheduler = new \Rx\Scheduler\EventLoopScheduler($loop); $source = \Rx\Observable::interval(1000, $scheduler) ->take(2) ->doOnNext(function ($x) { echo "Side effect\n"; }); $published = $source->shareValue(42); $published->subscribe($createStdoutObserver('SourceA ')); $published->subscribe($createStdoutObserver('SourceB ')); $loop->run(); ``` -------------------------------- ### Gradle Build Output Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation.markdown This is an example of the output you might see when building the RxJava project with Gradle. It shows the progress of various tasks like compilation, testing, and packaging. ```gradle :rxjava-core:compileJava :rxjava-core:processResources UP-TO-DATE :rxjava-core:classes :rxjava-core:jar :rxjava-core:sourcesJar :rxjava-core:signArchives SKIPPED :rxjava-core:assemble :rxjava-core:licenseMain UP-TO-DATE :rxjava-core:licenseTest UP-TO-DATE :rxjava-core:compileTestJava :rxjava-core:processTestResources UP-TO-DATE :rxjava-core:testClasses :rxjava-core:test :rxjava-core:check :rxjava-core:build BUILD SUCCESSFUL Total time: 30.758 secs ``` -------------------------------- ### Hello World in Multiple Languages Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation.markdown Demonstrates creating an Observable from a list of Strings and subscribing to it to print a greeting for each string. This example is provided for Java, Scala, Groovy, and Clojure. ```java import rx.Observable; public class HelloWorld { public static void main(String[] args) { Observable.just("World!").subscribe(s -> System.out.println("Hello " + s)); } } ``` ```scala import rx.lang.scala._ object HelloWorld { def main(args: Array[String]) = { Observable.just("World!").subscribe(s => println(s"Hello $s")) } } ``` ```groovy import rx.Observable Observable.just("World!").subscribe({ s -> println "Hello $s" }); ``` ```clojure (require '[rx.core]) (rx.core/subscribe (rx.core/just "World!") #(println (str "Hello " %))) (rx.core/await-all) ``` -------------------------------- ### Pixel Density Monitor Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/js/goog/demos/pixeldensitymonitor.html This snippet initializes a PixelDensityMonitor, starts monitoring for changes, and logs density changes to a console. It uses goog.events.listen to attach a listener to the CHANGE event. ```javascript goog.require('goog.debug.DivConsole'); goog.require('goog.events'); goog.require('goog.labs.style.PixelDensityMonitor'); goog.require('goog.labs.style.PixelDensityMonitor.Density'); goog.require('goog.log'); var logger = goog.log.getLogger('PixelDensityMonitor'); new goog.debug.DivConsole(goog.dom.getElement('log')).setCapturing(true); var monitor = new goog.labs.style.PixelDensityMonitor(); monitor.start(); var densityMap = goog.object.create( goog.labs.style.PixelDensityMonitor.Density.NORMAL, 'NORMAL', goog.labs.style.PixelDensityMonitor.Density.HIGH, 'HIGH'); goog.events.listen(monitor, goog.labs.style.PixelDensityMonitor.EventType.CHANGE, function() { goog.log.info(logger, 'Density change: ' + densityMap[monitor.getDensity()]); }); goog.log.info(logger, 'Starting density: ' + densityMap[monitor.getDensity()]); ``` -------------------------------- ### RxScala Package Initialization Source: https://github.com/reactivex/reactivex.github.io/blob/develop/rxscala/scaladoc/rx/lang/scala/package.html This snippet handles the initial page load for the rx.lang.scala package, ensuring the correct anchor and hash are set for navigation within the documentation. ```scala if(top === self) { var url = '../../../index.html'; var hash = 'rx.lang.scala.package'; var anchor = window.location.hash; var anchor_opt = ''; if (anchor.length >= 1) anchor_opt = '@' + anchor.substring(1); window.location.href = url + '#' + hash + anchor_opt; } ``` -------------------------------- ### RxJS start Operator Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/ko/operators/start.html The RxJS `start` operator takes a function, optional context, and an optional Scheduler. It executes the function asynchronously on the specified Scheduler and emits its return value. The example demonstrates starting a function with a specific context and using the `timeout` Scheduler. ```javascript var context = { value: 42 }; var source = Rx.Observable.start( function () { return this.value; }, context, Rx.Scheduler.timeout ); var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); }); // Output: // Next: 42 // Completed ``` -------------------------------- ### RxJava Basic Observable Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/js/goog/labs/useragent/platform_test.html Demonstrates the creation and subscription to a simple RxJava Observable. This example shows how to emit a string and handle the emitted item and completion events. ```java import io.reactivex.Observable; public class RxJavaExample { public static void main(String[] args) { Observable source = Observable.just("Hello", "RxJava"); source.subscribe( item -> System.out.println("Received: " + item), error -> System.err.println("Error: " + error), () -> System.out.println("Completed") ); } } ``` -------------------------------- ### Build RxJava from Source Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation.markdown These bash commands outline the process of cloning the RxJava repository and building it using Gradle. It includes steps for cloning the repository, navigating into the directory, and executing the build task. ```bash $ git clone git@github.com:Netflix/RxJava.git $ cd RxJava/ $ ./gradlew build ``` -------------------------------- ### RxJS start Operator Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/id/operators/start.html The RxJS `start` operator takes a function, optional context, and an optional Scheduler. It executes the function asynchronously on the specified Scheduler and emits its return value. The example demonstrates starting a function with a specific context and using the `timeout` Scheduler. ```javascript var context = { value: 42 }; var source = Rx.Observable.start( function () { return this.value; }, context, Rx.Scheduler.timeout ); var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); }); // Output: // Next: 42 // Completed ``` -------------------------------- ### RxPHP start Operator Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/operators/start.html The RxPHP `start` operator executes a given function asynchronously on a specified scheduler and emits the result. The example demonstrates invoking `Observable::start` with a closure and subscribing to the output. ```PHP $source = Rx\Observable::start(function () { return 42; }); $source->subscribe($stdoutObserver); ``` -------------------------------- ### AutoHotkey Script Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/polymer/components/core-component-page/core-component-page.html An example of an AutoHotkey script, showcasing comments, variables, and basic commands. ```autohotkey ; This is a comment MsgBox, Hello, World! MyVar := "Some text" MsgBox, %MyVar% ``` -------------------------------- ### RxPHP start Operator Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/cn/operators/start.html The RxPHP `start` operator executes a given function asynchronously on a specified scheduler and emits the result. The example demonstrates invoking `Observable::start` with a closure and subscribing to the output. ```PHP $source = Rx\Observable::start(function () { return 42; }); $source->subscribe($stdoutObserver); ``` -------------------------------- ### Introduction to RxJava for Android Source: https://github.com/reactivex/reactivex.github.io/blob/develop/tutorials.markdown Introductory materials covering the basics of RxJava for Android development. ```Java Introduction to RxJava for Android (Part 1): http://www.philosophicalhacker.com/2015/06/16/introduction-to-rxjava-for-android-the-talk/ Introduction to RxJava for Android (Part 2): http://www.philosophicalhacker.com/2015/06/19/introduction-to-rxjava-for-android-pt-2 ``` -------------------------------- ### Buffer with Opening and Closing Selectors (RxPY) Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/operators/buffer.html Starts by calling a `closing_selector` to get an Observable that governs the closing of buffers. When this Observable emits or terminates, the buffer is emitted, and a new one is started. ```Python source.buffer(opening_selector=opening_selector, buffer_closing_selector=closing_selector).subscribe() ``` -------------------------------- ### HTTP Request Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/polymer/components/core-component-page/core-component-page.html Demonstrates a basic HTTP request structure, including the method, path, and HTTP version. ```http GET /api/users HTTP/1.1 Host: example.com Accept: application/json ``` -------------------------------- ### CMakeLists.txt Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/polymer/components/core-component-page/core-component-page.html A basic CMakeLists.txt file to configure a project, including setting the minimum version and project name. ```cmake cmake_minimum_required(VERSION 3.10) project(MyProject) add_executable(my_app main.cpp) ``` -------------------------------- ### Buffer with Opening and Closing Selectors (RxPY) Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/cn/operators/buffer.html Starts by calling a `closing_selector` to get an Observable that governs the closing of buffers. When this Observable emits or terminates, the buffer is emitted, and a new one is started. ```Python source.buffer(opening_selector=opening_selector, buffer_closing_selector=closing_selector).subscribe() ``` -------------------------------- ### RxJava Basic Observable Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/js/goog/useragent/platform_test.html Demonstrates the creation and subscription to a simple Observable in RxJava. This example shows how to emit a string and handle its emission and completion. ```java import io.reactivex.Observable; public class RxJavaExample { public static void main(String[] args) { Observable source = Observable.just("Hello", "RxJava!"); source.subscribe( next -> System.out.println("Received: " + next), error -> System.err.println("Error: " + error), () -> System.out.println("Completed") ); } } ``` -------------------------------- ### RxPHP start Operator Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/ko/operators/start.html The RxPHP `start` operator asynchronously invokes a given function on a specified scheduler and surfaces the result through an observable sequence. The example demonstrates invoking a simple function that returns 42. ```php //from https://github.com/ReactiveX/RxPHP/blob/master/demo/start/start.php $source = Rx\Observable::start(function () { return 42; }); $source->subscribe($stdoutObserver); // Output: // Next value: 42 // Complete! ``` -------------------------------- ### RxPHP start Operator Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/id/operators/start.html The RxPHP `start` operator asynchronously invokes a given function on a specified scheduler and surfaces the result through an observable sequence. The example demonstrates invoking a simple function that returns 42. ```php //from https://github.com/ReactiveX/RxPHP/blob/master/demo/start/start.php $source = Rx\Observable::start(function () { return 42; }); $source->subscribe($stdoutObserver); // Output: // Next value: 42 // Complete! ``` -------------------------------- ### AdvancedTooltip Initialization and Configuration Source: https://github.com/reactivex/reactivex.github.io/blob/develop/js/goog/demos/advancedtooltip.html Demonstrates how to create and configure an AdvancedTooltip instance, set its content, enable cursor tracking, and manage visibility delays. It also shows how to nest tooltips and handle click events for closing. ```javascript var tooltip = new goog.ui.AdvancedTooltip('btn'); tooltip.className = 'tooltip'; tooltip.setHtml( "

AdvancedTooltip

" + "
Hover me " + "
", true); tooltip.setHotSpotPadding(new goog.math.Box(5, 5, 5, 5)); tooltip.setCursorTracking(true); tooltip.setMargin(new goog.math.Box(100, 0, 0, 100)); tooltip.setHideDelayMs(250); new goog.ui.AdvancedTooltip('btn-nest').setHtml( 'Clicking
this
button
has no effect.'); new goog.ui.Tooltip('btn-close', 'Closes tooltip'); goog.events.listen(document.getElementById('btn-close'), goog.events.EventType.CLICK, function(e) { tooltip.setVisible(false); }); ``` -------------------------------- ### RxJava for Android Developers Guide Source: https://github.com/reactivex/reactivex.github.io/blob/develop/tutorials.markdown An essential guide for Android developers looking to understand and implement RxJava. ```Java The Essential RxJava Guide For Android Developers: http://blog.jimbaca.com/essential-rxjava-guide-for-android-developers/ ``` -------------------------------- ### Polymer Core Transition Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/polymer/components/core-transition/core-transition.html This snippet demonstrates the usage of Polymer's 'core-transition' element to manage transitions. It defines the transition type, the 'go' function for initiating a transition, and 'complete' for handling transition completion and firing an event. ```JavaScript Polymer('core-transition', { type: 'transition', go: function(node, state) { this.complete(node); }, setup: function(node) { }, teardown: function(node) { }, complete: function(node) { this.fire('core-transitionend', null, node); } }); ``` -------------------------------- ### goog.Timer Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/js/goog/demos/timers.html Provides an example of using goog.Timer to execute a function repeatedly at a set interval (tick). It covers starting, stopping, and restarting the timer, as well as handling the tick events. ```javascript var timer = null; var timerStatus = goog.dom.getElement('timerStatus'); var tickCount = 0; var doTimerStart = function() { var seconds = getSeconds('timerSeconds'); if (!goog.isNumber(seconds)) { return; } if (timer) { timer.dispose(); tickCount = 0; } timer = new goog.Timer(inMs(seconds)); timer.start(); goog.events.listen(timer, goog.Timer.TICK, tickAction); }; var doTimerStop = function() { if (timer) { timer.stop(); } }; var doTimerRestart = function() { if (timer) { timer.start(); } }; var tickAction = function() { tickCount++; goog.dom.setTextContent(timerStatus, 'Got tick: ' + tickCount); }; ``` -------------------------------- ### RxSwing Resources Source: https://github.com/reactivex/reactivex.github.io/blob/develop/tutorials.markdown Examples of using RxJava and RxSwing for Java MVVM with Swing applications. ```APIDOC RxSwing: - Java MVVM with Swing, RxJava and RxSwing examples: https://github.com/Petikoch/Java_MVVM_with_Swing_and_RxJava_Examples ``` -------------------------------- ### RxJS reduce Operator Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/pt-br/operators/reduce.html Demonstrates the usage of the reduce operator in RxJS. It takes an accumulator function and an optional seed value. The example shows how to multiply numbers from 1 to 3, starting with a seed of 1. ```javascript var source = Rx.Observable.range(1, 3) .reduce(function (acc, x) { return acc * x; }, 1) var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); }); // Output: // Next: 6 // Completed ``` -------------------------------- ### Reactive Streams and RxJava Documentation Source: https://github.com/reactivex/reactivex.github.io/blob/develop/tutorials.markdown Links to official documentation, guidelines, and translated resources for Reactive Streams and RxJava. ```APIDOC 101 Rx Samples Wiki: http://rxwiki.wikidot.com/101samples Rx Design Guidelines: http://go.microsoft.com/fwlink/?LinkID=205219 Beginners Guide to Rx: http://msdn.microsoft.com/en-us/data/gg577611 Reactive Manifesto: http://www.reactivemanifesto.org/ ReactiveX文档中文翻译: http://mcxiaoke.gitbooks.io/rxdocs/content/ ``` -------------------------------- ### RxSwift generate Operator Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/operators/create.html Demonstrates the `generate` operator in RxSwift for creating Observables. This example generates a sequence of numbers starting from 0 up to (but not including) 3. The output shows the emitted numbers and a completion message. ```swift let source = Observable.generate( initialState: 0, condition: { $0 < 3 }, iterate: { $0 + 1 } ) source.subscribe { print($0) } // Output: // next(0) // next(1) // next(2) // completed ``` -------------------------------- ### Complete Subscribe Example with Callbacks Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/id/observable.markdown Provides a comprehensive example of subscribing an observer to an Observable, including handlers for onNext, onError, and onCompleted events. ```groovy def myOnNext = { item -> /* lakukan sesuatu dengan item */ }; def myError = { throwable -> /* bereaksi terhadap suatu pemanggilan yang gagal */ }; def myComplete = { /* membersihkan respon terakhir */ }; def myObservable = someMethod(itsParameters); myObservable.subscribe(myOnNext, myError, myComplete); // lanjut mengerjakan proses bisnis ``` -------------------------------- ### RxSwift generate Operator Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/cn/operators/create.html Demonstrates the `generate` operator in RxSwift for creating Observables. This example generates a sequence of numbers starting from 0 up to (but not including) 3. The output shows the emitted numbers and a completion message. ```swift let source = Observable.generate( initialState: 0, condition: { $0 < 3 }, iterate: { $0 + 1 } ) source.subscribe { print($0) } // Output: // next(0) // next(1) // next(2) // completed ``` -------------------------------- ### RxJava Basic Usage Source: https://github.com/reactivex/reactivex.github.io/blob/develop/js/goog/demos/xpc/relay.html Demonstrates basic RxJava usage with creating an observable and subscribing to it. ```java Observable observable = Observable.just("Hello", "RxJava"); observable.subscribe(new Observer() { @Override public void onNext(String s) { System.out.println(s); } @Override public void onError(Throwable throwable) { throwable.printStackTrace(); } @Override public void onComplete() { System.out.println("Completed!"); } }); ``` -------------------------------- ### RxJS Pluck Operator Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/pt-br/operators/map.html Illustrates the `pluck` operator in RxJS, which is used to extract a specific property from each object emitted by an Observable. The example shows how to use `pluck` to get the 'value' property from an array of objects. It also mentions that `pluck` is a simpler version of `map`. ```JavaScript var source = Rx.Observable .fromArray([ { value: 0 }, { value: 1 }, { value: 2 } ]) .pluck('value'); var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); }); // Output: // Next: 0 // Next: 1 // Next: 2 // Completed ``` -------------------------------- ### RxJS Examples for React and Angular Source: https://github.com/reactivex/reactivex.github.io/blob/develop/tutorials.markdown Demonstrations and projects showcasing the use of RxJS with popular JavaScript frameworks like React and Angular. ```JavaScript React RxJS Autocomplete: https://github.com/eliseumds/react-autocomplete React RxJS TODO MVC: https://github.com/fdecampredon/react-rxjs-todomvc Ninya.io - Angular + RxJS + rx.angular.js: https://github.com/ninya-io/ninya.io ``` -------------------------------- ### RxPHP groupByUntil Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/operators/groupby.html Demonstrates the groupByUntil operator in RxPHP, which groups elements of an observable sequence into observable sequences of observable sequences. It uses a duration selector to determine when to close the current group and start a new one. The example shows grouping by 'id' and closing groups after a delay. ```php $codes = [ ['id' => 38], ['id' => 38], ['id' => 40], ['id' => 40], ['id' => 37], ['id' => 39], ['id' => 37], ['id' => 39], ['id' => 66], ['id' => 65] ]; $source = Rx\Observable ::fromArray($codes) ->concatMap(function ($x) { return \Rx\Observable::timer(100)->mapTo($x); }) ->groupByUntil( function ($x) { return $x['id']; }, function ($x) { return $x['id']; }, function ($x) { return Rx\Observable::timer(200); }); $subscription = $source->subscribe(new CallbackObserver( function (\Rx\Observable $obs) { // Print the count $obs->count()->subscribe(new CallbackObserver( function ($x) { echo 'Count: ', $x, PHP_EOL; })); }, function (Throwable $err) { echo 'Error', $err->getMessage(), PHP_EOL; }, function () { echo 'Completed', PHP_EOL; })); ``` -------------------------------- ### RxPHP groupByUntil Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/cn/operators/groupby.html Demonstrates the groupByUntil operator in RxPHP, which groups elements of an observable sequence into observable sequences of observable sequences. It uses a duration selector to determine when to close the current group and start a new one. The example shows grouping by 'id' and closing groups after a delay. ```php $codes = [ ['id' => 38], ['id' => 38], ['id' => 40], ['id' => 40], ['id' => 37], ['id' => 39], ['id' => 37], ['id' => 39], ['id' => 66], ['id' => 65] ]; $source = Rx\Observable ::fromArray($codes) ->concatMap(function ($x) { return \Rx\Observable::timer(100)->mapTo($x); }) ->groupByUntil( function ($x) { return $x['id']; }, function ($x) { return $x['id']; }, function ($x) { return Rx\Observable::timer(200); }); $subscription = $source->subscribe(new CallbackObserver( function (\Rx\Observable $obs) { // Print the count $obs->count()->subscribe(new CallbackObserver( function ($x) { echo 'Count: ', $x, PHP_EOL; })); }, function (Throwable $err) { echo 'Error', $err->getMessage(), PHP_EOL; }, function () { echo 'Completed', PHP_EOL; })); ``` -------------------------------- ### RxJS Resources Source: https://github.com/reactivex/reactivex.github.io/blob/develop/tutorials.markdown Links to online books, tutorials, talks, and tools for learning and using RxJS, a JavaScript library for functional reactive programming. ```APIDOC RxJS: - RxJS - Javascript library for functional reactive programming: http://xgrommx.github.io/rx-book/index.html - Learn RxJS: http://reactivex.io/learnrx/ - RxJS Koans: https://github.com/mattpodwysocki/RxJSKoans - RxJS Observables vs. Promises: https://egghead.io/lessons/rxjs-rxjs-observables-vs-promises - rxvision (visualizer debugger): http://react.rocks/example/rxvision - Rx Visualizer (playground): https://rxviz.com - RxJS Session at DevNation: http://www.bleathem.ca/blog/2015/06/rxjs-devnation.html - RxJS talk slides: https://www.icloud.com/keynote/AwBWCAESEIf9pea2IykiVtOZFiXflDsaKj9lVsSLP_OtPU29v7fNpMs78DK7tvXz4bFBkb6BXFKjxqt4G5B_UlM6TwMCUCAQEEIGVYVFig5qOTdorTOd2ERMJDtn6dvDFY58zqBiVzZmtN#RxJS_talk - Building an RSS reader with RxJS: https://github.com/channikhabra/yarr ``` -------------------------------- ### Vert.x and RxJava Source: https://github.com/reactivex/reactivex.github.io/blob/develop/tutorials.markdown A presentation by @petermd on the integration and usage of RxJava with the Vert.x toolkit. ```Java http://slid.es/petermd/eclipsecon2014 ``` -------------------------------- ### RxJava startFuture Operator Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/ko/operators/start.html The `startFuture` operator takes a function that returns a `Future`. It immediately calls this function to get the `Future`, then calls its `get()` method to obtain the value, emitting it to observers. The function and `Future.get()` are executed only once. ```Java Observable startFuture(Func0> func); Observable startFuture(Func0> func, Scheduler scheduler); // Example: CompletableFuture future = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(600); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } return "Future Result"; }); Observable observable = Observable.startFuture(() -> future); observable.subscribe(System.out::println); // Output: Future Result (after 0.6 seconds) ``` -------------------------------- ### Basic RxJava Observable Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/js/goog/demos/xpc/inner.html Demonstrates the creation and subscription to a simple RxJava Observable. This is a fundamental example for understanding reactive streams. ```java import io.reactivex.Observable; public class RxJavaExample { public static void main(String[] args) { Observable source = Observable.just("Hello", "RxJava!"); source.subscribe(System.out::println); } } ``` -------------------------------- ### RxJava startFuture Operator Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/id/operators/start.html The `startFuture` operator takes a function that returns a `Future`. It immediately calls this function to get the `Future`, then calls its `get()` method to obtain the value, emitting it to observers. The function and `Future.get()` are executed only once. ```Java Observable startFuture(Func0> func); Observable startFuture(Func0> func, Scheduler scheduler); // Example: CompletableFuture future = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(600); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } return "Future Result"; }); Observable observable = Observable.startFuture(() -> future); observable.subscribe(System.out::println); // Output: Future Result (after 0.6 seconds) ``` -------------------------------- ### RxSwift generate Operator Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/ko/operators/create.html Provides an example of the `generate` operator in RxSwift for creating an Observable. This snippet demonstrates creating an observable that emits numbers starting from 0, continuing as long as the number is less than 3, and incrementing the number in each step. The output shows the emitted sequence of numbers and the completion message. ```Swift let source = Observable.generate( initialState: 0, condition: { $0 < 3 }, iterate: { $0 + 1 } ) source.subscribe { print($0) } ``` -------------------------------- ### Polymer Match Media Initialization Source: https://github.com/reactivex/reactivex.github.io/blob/develop/polymer/components/core-media-query/demo.html Initializes a Polymer element to match a specific media query. This allows the element to react to changes in screen size or other media characteristics. ```javascript Polymer('match-example', { query: 'min-width: 600px' }); ``` -------------------------------- ### RxSwift generate Operator Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/id/operators/create.html Provides an example of the `generate` operator in RxSwift for creating an Observable. This snippet demonstrates creating an observable that emits numbers starting from 0, continuing as long as the number is less than 3, and incrementing the number in each step. The output shows the emitted sequence of numbers and the completion message. ```Swift let source = Observable.generate( initialState: 0, condition: { $0 < 3 }, iterate: { $0 + 1 } ) source.subscribe { print($0) } ``` -------------------------------- ### Implementing an Event Bus with RxJava Source: https://github.com/reactivex/reactivex.github.io/blob/develop/tutorials.markdown A blog post by Kaushik Gopal explaining how to build an event bus using RxJava's Observable pattern. ```Java https://blog.kaush.co/2014/12/24/implementing-an-event-bus-with-rxjava-rxbus ``` -------------------------------- ### Basic RxJava Observable Example Source: https://github.com/reactivex/reactivex.github.io/blob/develop/js/goog/ui/menubutton_test_frame.html Demonstrates the creation and subscription to a simple RxJava Observable. This is a fundamental example for understanding reactive programming in Java. ```java Observable observable = Observable.just("Hello", "RxJava"); observable.subscribe(new Observer() { @Override public void onSubscribe(Disposable d) { System.out.println("Subscribed"); } @Override public void onNext(String s) { System.out.println(s); } @Override public void onError(Throwable e) { e.printStackTrace(); } @Override public void onComplete() { System.out.println("Completed"); } }); ``` -------------------------------- ### RxPHP take(count) Source: https://github.com/reactivex/reactivex.github.io/blob/develop/documentation/ko/operators/take.html Returns a specified number of contiguous elements from the start of an observable sequence. The example demonstrates taking the first 2 elements from an array. ```PHP $observable = Rx\Observable::fromArray([21, 42, 63]); $observable ->take(2) ->subscribe($stdoutObserver); ```