Skip to content
This repository was archived by the owner on Oct 28, 2022. It is now read-only.

Commit 1040193

Browse files
author
NOPR9D ☄️
authored
Merge pull request #18 from NOPR9D/20211205_clean
clean
2 parents 8da4e56 + a880672 commit 1040193

File tree

4 files changed

+39
-8
lines changed

4 files changed

+39
-8
lines changed

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<img src="https://i.ibb.co/q5267TX/maxresdefault-2.jpg" width="25%" />
55
</div>
66

7-
### [RxJS v6](https://github.com/ReactiveX/rxjs) integration for [Vue next]()
7+
### [RxJS v7](https://github.com/ReactiveX/rxjs) integration for [Vue next]()
88

99
</br>
1010

@@ -14,8 +14,13 @@
1414
<br>
1515

1616

17-
# Update 1.0.8
18-
Now using Rxjs v7
17+
# Update 1.0.9
18+
- Now using Rxjs v7
19+
- Fix undefined in case of created hook
20+
21+
---
22+
<br/>
23+
---
1924

2025
> **NOTE**
2126
>
@@ -331,6 +336,24 @@ Test look goods, feel free to open an issue !
331336
332337
---
333338
339+
### Contributors
340+
341+
<div align="center" style="display:flex;" >
342+
<div style="display:flex; flex-direction:row;align-items:center;width:50%;">
343+
<a href="https://github.com/NOPR9D">
344+
<img style="border-radius:100px; margin:auto;" src="https://avatars.githubusercontent.com/u/75882457?v=4" width="25%" />
345+
<div>NOPR9D</div></a>
346+
</div>
347+
<div style="display:flex; flex-direction:row;align-items:center; width:50%;" >
348+
<a href="https://github.com/AlvinTCH">
349+
<img style="border-radius:100px; margin:auto;" src="https://avatars.githubusercontent.com/u/48837852?v=4" width="25%" />
350+
<div>AlvinTCH</div>
351+
</a>
352+
</div>
353+
</div>
354+
355+
---
356+
334357
## License
335358
336359
[MIT](http://opensource.org/licenses/MIT)

example/subscribeTo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
},
1818
}).use(VueNextRx);
1919
app.mount("#app");
20-
</script>
20+
</script>

src/mixin.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { warn } from "./util";
1+
import { uuidv4, warn } from "./util";
22
import { Subject, Subscription, isObservable } from "rxjs";
33
import { getCurrentInstance } from "vue";
44

5-
import { v4 as uuidv4 } from "uuid";
65
export default {
76
created() {
87
var vm = this;
@@ -51,11 +50,11 @@ export default {
5150
obs[key].subscribe(
5251
(value) => {
5352
vm[key] = value;
54-
const currentInst = getCurrentInstance();
55-
const newKey = uuidv4();
5653
try {
5754
vm.$forceUpdate();
5855
} catch (e) {
56+
const currentInst = getCurrentInstance();
57+
const newKey = uuidv4();
5958
// try to force new key if force update fails (usually fails when it is created on created hook)
6059
if (currentInst && currentInst.vnode) {
6160
currentInst.vnode.key = newKey;

src/util.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,12 @@ export function defineReactive(vm, key, val) {
1818
export function getKey(binding) {
1919
return [binding.arg].concat(Object.keys(binding.modifiers)).join(":");
2020
}
21+
22+
export function uuidv4() {
23+
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>
24+
(
25+
c ^
26+
(crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))
27+
).toString(16)
28+
);
29+
}

0 commit comments

Comments
 (0)