Skip to content

Instantly share code, notes, and snippets.

@webhipster
Created July 16, 2017 05:46
Show Gist options
  • Save webhipster/4a12c19a56deea7f4148338bbcf5333d to your computer and use it in GitHub Desktop.
Save webhipster/4a12c19a56deea7f4148338bbcf5333d to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/habicazori
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.6/rx.all.js"></script>
<title>JS Bin</title>
</head>
<body>
<input id="textbox" />
<script id="jsbin-javascript">
"use strict";
var Observable = Rx.Observable;
var vals = [1, 2, 3].map(function (x) {
return x + 1;
});
var textbox = document.getElementById("textbox");
var keypresses = Observable.fromEvent(textbox, 'keypress');
keypresses.forEach(function (e) {
return console.log(e.keyCode);
});
function searchWikipedia(term) {
var url = "https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=" + encodeURIComponent(term) + "&callback=?";
console.log(url);
}
searchWikipedia('Terminator');
</script>
<script id="jsbin-source-javascript" type="text/javascript">var Observable = Rx.Observable;
var vals = [1,2,3].map(x => x +1);
var textbox = document.getElementById("textbox");
var keypresses = Observable.fromEvent(textbox, 'keypress');
keypresses.forEach(e => console.log(e.keyCode));
function searchWikipedia(term) {
var url = "https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=" + encodeURIComponent(term) + "&callback=?";
console.log(url);
}
searchWikipedia('Terminator');</script></body>
</html>
"use strict";
var Observable = Rx.Observable;
var vals = [1, 2, 3].map(function (x) {
return x + 1;
});
var textbox = document.getElementById("textbox");
var keypresses = Observable.fromEvent(textbox, 'keypress');
keypresses.forEach(function (e) {
return console.log(e.keyCode);
});
function searchWikipedia(term) {
var url = "https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=" + encodeURIComponent(term) + "&callback=?";
console.log(url);
}
searchWikipedia('Terminator');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment