Skip to content

Instantly share code, notes, and snippets.

@mezigh
Created June 10, 2015 14:56
Show Gist options
  • Save mezigh/a6c5c63b0f147d485c9f to your computer and use it in GitHub Desktop.
Save mezigh/a6c5c63b0f147d485c9f to your computer and use it in GitHub Desktop.
JS Bin RxJS on the workbench // source http://jsbin.com/fatofa
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="RxJS on the workbench">
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/2.3.22/rx.all.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
console.clear();
var reserv = ["one","two"];
Array.observe(reserv, function (changes) {
var source = Rx.Observable.create(function (observer) {
reserv.forEach(function (el) {
observer.onNext(el);
});
observer.completed();
return function () {
console.log("DISPOSE");
};
});
var subscribtion = source.subscribe(
function (el) {
console.log("Next Item: " + el + " at: " + Date());
},
function (error) {
console.log("ERRROR !");
},
function () {
console.log("COMPLETLY DONE !!!");
}
);
});
</script>
<script id="jsbin-source-javascript" type="text/javascript">console.clear();
var reserv = ["one","two"];
Array.observe(reserv, function (changes) {
var source = Rx.Observable.create(function (observer) {
reserv.forEach(function (el) {
observer.onNext(el);
});
observer.completed();
return function () {
console.log("DISPOSE");
};
});
var subscribtion = source.subscribe(
function (el) {
console.log("Next Item: " + el + " at: " + Date());
},
function (error) {
console.log("ERRROR !");
},
function () {
console.log("COMPLETLY DONE !!!");
}
);
});
</script></body>
</html>
console.clear();
var reserv = ["one","two"];
Array.observe(reserv, function (changes) {
var source = Rx.Observable.create(function (observer) {
reserv.forEach(function (el) {
observer.onNext(el);
});
observer.completed();
return function () {
console.log("DISPOSE");
};
});
var subscribtion = source.subscribe(
function (el) {
console.log("Next Item: " + el + " at: " + Date());
},
function (error) {
console.log("ERRROR !");
},
function () {
console.log("COMPLETLY DONE !!!");
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment