Permalink
Browse files

new file added

  • Loading branch information...
1 parent 69dbe73 commit 96711215b3b58a25f3cd024bd9fccb71ce02d51f @hanskishore committed Feb 17, 2012
Showing with 46 additions and 0 deletions.
  1. +46 −0 scripts/extensions.js
View
@@ -0,0 +1,46 @@
+alert('were are you');
+
+(function($){
+
+
+ $.fn.addeventObservable = function(eventName,handler) {
+ var element = this;
+ return Rx.Observable.create(
+ function(observer){debugger;
+ var handler1 = function(eventObject){debugger;
+ observer.onNext(eventObject);
+ //$("#container").append("here we are");
+ }
+ $("document").on(eventName, handler, handler1);
+ return function()
+ {
+ $("document").off(eventName, handler1);
+ }
+ }
+ );
+ };
+})(jQuery);
+
+(function($){
+ $.fn.addListener=function(eventName, handler){
+ $(this).on(eventName, handler);
+ };
+
+ $.fn.removeListener = function(eventName, handler){
+ $(this).off(eventName, handler);
+ };
+
+ $.fn.fromEvent = function(eventName){debugger;
+ return Rx.Observable.create(function (observer){
+ var handler = function (ev) {
+ observer.onNext(ev);
+ };
+ $(this).addListener(eventName, handler);
+ return function () {
+ $(this).removeListener(eventName, handler);
+ };
+
+ });
+ }
+
+})(jQuery);

0 comments on commit 9671121

Please sign in to comment.