Return to Snippet

Revision: 51039
at September 13, 2011 04:40 by RichardCustance


Updated Code
$.widget("example.firehose", {
    _create: function () {
        // Closure
	var self = this;
	var o = self.options;
	var el = self.element;
 
        // Create a Reactive JavaScript (RxJS) observable, which creates a sequence of 
	// mouse move events
	o.firehose = $(document).toObservable("mousemove").Select(function (eventData) {
	    return eventData;
	});
 
	// Subscribe the DOM element to which we are attached to the mousemove events
	o.firehose.Subscribe(function (eventData) {
            // Write the X and Y coordinates into the DOM element we have attached to
	    $(el[0]).text(eventData.offsetX + "," + eventData.offsetY);
	});
    }
});

Revision: 51038
at September 13, 2011 04:39 by RichardCustance


Initial Code
$.widget("ui.firehose", {
    _create: function () {
        // Closure
	var self = this;
	var o = self.options;
	var el = self.element;
 
        // Create a Reactive JavaScript (RxJS) observable, which creates a sequence of 
	// mouse move events
	o.firehose = $(document).toObservable("mousemove").Select(function (eventData) {
	    return eventData;
	});
 
	// Subscribe the DOM element to which we are attached to the mousemove events
	o.firehose.Subscribe(function (eventData) {
            // Write the X and Y coordinates into the DOM element we have attached to
	    $(el[0]).text(eventData.offsetX + "," + eventData.offsetY);
	});
    }
});

Initial URL
http://www.sage.co.uk/devblog

Initial Description


Initial Title
jQuery UI Widget + RxJS Example (mouseover firehose)

Initial Tags
javascript, jquery

Initial Language
jQuery