Skip to content

Commit f2368cc

Browse files
authored
Migration guide for v4 (#351)
* Migration guide for v4 * headers fix in docs.
1 parent 60a0439 commit f2368cc

File tree

3 files changed

+59
-4
lines changed

3 files changed

+59
-4
lines changed

site/content/docs/migration/v3.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ sidebarPartial: docsSidebar
1010
- [RxJS imports](#rxjs-imports)
1111
- [Lodash imports](#lodash-imports)
1212
- [Webpack builds](#webpack-builds)
13-
- [`frint-store`](#frint-store)
14-
- [`frint-model`](#frint-model)
15-
- [`frint-compat`](#frint-compat)
13+
- [frint-store](#frint-store)
14+
- [frint-model](#frint-model)
15+
- [frint-compat](#frint-compat)
1616

1717
<!-- /MarkdownTOC -->
1818

@@ -33,6 +33,7 @@ const todos$ = store.getState$()
3333

3434
todos$.subscribe(todos => console.log(todos));
3535
```
36+
3637
### After
3738

3839
```js
@@ -79,7 +80,7 @@ import _ from 'lodash';
7980
_.isPlainObject({});
8081
```
8182

82-
## After
83+
### After
8384

8485
```js
8586
import isPlainObject from 'lodash/isPlainObject';

site/content/docs/migration/v4.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: Migrating from v3.x to v4.x
3+
sidebarPartial: docsSidebar
4+
---
5+
6+
# Migrating from v3.x to v4.x
7+
8+
FrintJS itself doesn't have any breaking changes in this release. The only reason for a major semver is because of RxJS v5.5+ requirement.
9+
10+
<!-- MarkdownTOC depth=1 autolink=true bracket=round -->
11+
12+
- [RxJS](#rxjs)
13+
14+
<!-- /MarkdownTOC -->
15+
16+
## RxJS
17+
18+
We now use [lettable operators](https://github.com/ReactiveX/rxjs/blob/master/doc/lettable-operators.md) since RxJS v5.5.0, which has resulted into smaller bundle sizes without requiring any stage-1 or below language features.
19+
20+
### Before
21+
22+
```js
23+
import { of } from 'rxjs/observable/of';
24+
import { filter } from 'rxjs/operator/filter'; // singular `operator`
25+
import { map } from 'rxjs/operator/map'; // singular `operator`
26+
27+
const numbers$ = of(1, 2, 3)
28+
::filter(x => x % 2 === 0)
29+
::map(x => x * 10);
30+
31+
numbers$.subscribe(x => console.log(x));
32+
// outputs: 20
33+
```
34+
35+
The code above is written using [bind-operator](https://github.com/tc39/proposal-bind-operator).
36+
37+
### After
38+
39+
```js
40+
import { of } from 'rxjs/observable/of';
41+
import { filter } from 'rxjs/operators/filter'; // plural `operators`
42+
import { map } from 'rxjs/operators/map'; // plural `operators`
43+
44+
const numbers$ = of(1, 2, 3).pipe(
45+
filter(x => x % 2 === 0),
46+
map(x => x * 10)
47+
);
48+
49+
numbers$.subscribe(x => console.log(x));
50+
// outputs: 20
51+
```
52+
53+
Instead of using bind-operator, we are using the new `.pipe()` method that all Observables now expose in their instances.

site/partials/docsSidebar.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<li><a href="/docs/migration/v1">Migrating to v1.x</a></li>
3838
<li><a href="/docs/migration/v2">Migrating to v2.x</a></li>
3939
<li><a href="/docs/migration/v3">Migrating to v3.x</a></li>
40+
<li><a href="/docs/migration/v4">Migrating to v4.x</a></li>
4041
</ul>
4142

4243
<p class="menu-label">

0 commit comments

Comments
 (0)