Created
September 27, 2017 18:22
-
-
Save miladvafaeifard/964391f44596f39a97f20cfb343ce23a to your computer and use it in GitHub Desktop.
RxJS 5 Operators // source http://jsbin.com/qakevaj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>RxJS 5 Operators</title> | |
<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.3/dist/global/Rx.umd.js"></script> | |
</head> | |
<body> | |
<input type="text" id="example" /> | |
<script id="jsbin-javascript"> | |
var myEvent = function(name) { | |
let that = this; | |
that.name = name; | |
let boob = { | |
name: 'A woman', | |
touch: function(){ | |
console.log(this.name + " is running away from " + that.name); | |
} | |
}; | |
let pussy = { | |
fuck: function () { | |
console.log(that.name + '! go hell'); | |
} | |
}; | |
let partOfBody = { | |
'boob': boob, | |
'pussy': pussy | |
}; | |
// function run(action, func){ | |
// func(partOfBody[action]); | |
// } | |
return { | |
on: function(action, func){ | |
//run(action, func) | |
return function(){ | |
func(partOfBody[action]) | |
}(); | |
} | |
} | |
}; | |
event = new myEvent('milad'); | |
event.on('boob', function(man){ | |
man.touch(); | |
}); | |
event.on('pussy', function(man){ | |
man.fuck(); | |
}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var myEvent = function(name) { | |
let that = this; | |
that.name = name; | |
let boob = { | |
name: 'A woman', | |
touch: function(){ | |
console.log(this.name + " is running away from " + that.name); | |
} | |
}; | |
let pussy = { | |
fuck: function () { | |
console.log(that.name + '! go hell'); | |
} | |
}; | |
let partOfBody = { | |
'boob': boob, | |
'pussy': pussy | |
}; | |
// function run(action, func){ | |
// func(partOfBody[action]); | |
// } | |
return { | |
on: function(action, func){ | |
//run(action, func) | |
return function(){ | |
func(partOfBody[action]) | |
}(); | |
} | |
} | |
}; | |
event = new myEvent('milad'); | |
event.on('boob', function(man){ | |
man.touch(); | |
}); | |
event.on('pussy', function(man){ | |
man.fuck(); | |
}); | |
</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myEvent = function(name) { | |
let that = this; | |
that.name = name; | |
let boob = { | |
name: 'A woman', | |
touch: function(){ | |
console.log(this.name + " is running away from " + that.name); | |
} | |
}; | |
let pussy = { | |
fuck: function () { | |
console.log(that.name + '! go hell'); | |
} | |
}; | |
let partOfBody = { | |
'boob': boob, | |
'pussy': pussy | |
}; | |
// function run(action, func){ | |
// func(partOfBody[action]); | |
// } | |
return { | |
on: function(action, func){ | |
//run(action, func) | |
return function(){ | |
func(partOfBody[action]) | |
}(); | |
} | |
} | |
}; | |
event = new myEvent('milad'); | |
event.on('boob', function(man){ | |
man.touch(); | |
}); | |
event.on('pussy', function(man){ | |
man.fuck(); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment