Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
209 changes: 160 additions & 49 deletions README.md

Large diffs are not rendered by default.

Binary file added RxJs-no-framework/Stream-of-data-manipulation.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions RxJs-no-framework/playground-prebuilt/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
24 changes: 24 additions & 0 deletions RxJs-no-framework/playground-prebuilt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Make sure you have node installed.
```Bash
# To get this project ready, type the following commands from a command line in this directory:
npm install
npm install gulpjs/gulp-cli#4.0 -g # install gulp globally, if it is also installed inside the directory where you run your gulp command, it will take the local gulp version
npm install live-server -g

# To watch and build our server and client scripts, run:
gulp watch:scripts

# ALWAYS HAVE THAT TASK RUNNING WHEN DEVELOPING

# To launch the server for client-side examples:
live-server public

# To launch a server-side example in node:
npm run nodemon build/example_xx # Where "xx" is example number.

npm run nodemon here_of_file_you_have_on_server_dir

# hit Ctrl + S to restart the server whenever needed
# Ctrl + C to stop the server

```
70 changes: 70 additions & 0 deletions RxJs-no-framework/playground-prebuilt/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
"use strict";

var gulp = require("gulp"),
$ = require("gulp-load-plugins")(),
source = require("vinyl-source-stream"),
browserify = require("browserify"),
watchify = require("watchify"),
babelify = require("babelify"),
path = require("path"),
fs = require("fs");

gulp.task("scripts:server", () => {
return gulp.src("./src-server/**/*.js")
.pipe($.cached("server"))
.pipe($.babel())
.pipe(gulp.dest("./build"));
});

gulp.task("watch:scripts:server", gulp.series(
"scripts:server",
() => gulp.watch("./src-server/**/*.js", gulp.series("scripts:server"))));

gulp.task("watch:scripts:client", () => {
const files = fs.readdirSync("./src-client");
for (let i = 0; i < files.length; i++) {
const file = files[i];
if (path.extname(file) !== ".js")
continue;

initBundlerWatch(path.join("src-client", file));
}

return gulp.watch("./src-client/**/*.js")
.on("change", initBundlerWatch);
});

gulp.task("watch:scripts", gulp.parallel(
"watch:scripts:client",
"watch:scripts:server"))

let bundlers = {};
function initBundlerWatch(file) {
if (bundlers.hasOwnProperty(file))
return;

const bundler = createBundler(file);
bundlers[file] = bundler;

const watcher = watchify(bundler);
const filename = path.basename(file);

function bundle() {
return bundler
.bundle()
.on("error", error => console.error(error))
.pipe(source(filename))
.pipe(gulp.dest("./public/build"));
}

watcher.on("update", bundle);
watcher.on("time", time => console.log(`Built client in ${time}ms`));

bundle();
}

function createBundler(file) {
const bundler = browserify(file);
bundler.transform(babelify);
return bundler;
}
30 changes: 30 additions & 0 deletions RxJs-no-framework/playground-prebuilt/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "playground",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"nodemon": "nodemon --watch build"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-preset-es2015": "^6.5.0",
"babelify": "^7.2.0",
"browserify": "^13.0.0",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-babel": "^6.1.2",
"gulp-cached": "^1.1.0",
"gulp-load-plugins": "^1.2.0",
"nodemon": "^1.8.1",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.7.0"
},
"dependencies": {
"colour": "^0.7.1",
"jquery": "^3.5.1",
"lodash": "^4.5.0",
"moment": "^2.11.2",
"rxjs": "^5.0.0-beta.2"
}
}
11 changes: 11 additions & 0 deletions RxJs-no-framework/playground-prebuilt/public/example_00.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<h1>Example!</h1>

<script src="/build/example_00.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import moment from "moment";
import $ from "jquery";

$("body").text(moment().format());
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import moment from "moment";

console.log(moment().format());

console.log("HELLO WORLD");
7 changes: 7 additions & 0 deletions RxJs-no-framework/playground-prebuilt/src-server/lib/util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function createSubscriber(tag) {
return {
next(item) { console.log(`${tag}.next ${item}`); },
error(error) { console.log(`${tag}.error ${error.stack || error}`); },
complete() { console.log(`${tag}.complete`); }
};
}