This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createApp } from 'vue' | |
| import App from './App.vue' | |
| import store from './store' | |
| createApp(App).use(store).mount('#app') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createStore } from 'vuex' | |
| export default createStore({ | |
| state: { | |
| }, | |
| mutations: { | |
| }, | |
| actions: { | |
| }, | |
| modules: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { tap, retryWhen } from 'rxjs/operators'; | |
| import { webSocket } from 'rxjs/webSocket'; | |
| import { timer } from 'rxjs'; | |
| const wsSubjectConfig = { | |
| url: 'wss://www.gasnow.org/ws/gasprice', | |
| // added this to the config object | |
| closeObserver: { | |
| // this is triggered when connection is closed | |
| next(event) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { tap. retryWhen } from 'rxjs/operators'; | |
| import { webSocket } from 'rxjs/webSocket'; | |
| import { timer } from 'rxjs'; | |
| const wsSubjec2$ = webSocket({ | |
| url: 'wss://www.gasnow.org/ws/gasprice', | |
| }); | |
| wsSubject$ | |
| .pipe( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { tap } from 'rxjs/operators'; | |
| import { webSocket } from 'rxjs/webSocket'; | |
| const wsSubjec2$ = webSocket({ | |
| url: 'wss://www.gasnow.org/ws/gasprice', | |
| }); | |
| const subA = wsSubject$ | |
| .pipe( | |
| tap(data => console.log(data)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { tap } from 'rxjs/operators'; | |
| import { webSocket } from 'rxjs/webSocket'; | |
| const wsSubjec2$ = webSocket({ | |
| url: 'wss://www.gasnow.org/ws/gasprice', | |
| }); | |
| wsSubject$ | |
| .pipe( | |
| tap((data) => console.log(data)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { webSocket } from 'rxjs/webSocket'; | |
| const wsSubject$ = webSocket('wss://www.gasnow.org/ws/gasprice'); | |
| // or | |
| const wsSubjec2$ = webSocket({ | |
| url: 'wss://www.gasnow.org/ws/gasprice' | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data class Song(val genre: String, val artist: String){ | |
| var title: String; | |
| } | |
| val songA: Song = Song("Pop", "Jamie") | |
| val songB: Song = Song("Pop", "Jamie") | |
| songA.title = "Take the train" | |
| songB.title = "All blues" | |
| songA.equals(songB) // true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Song { | |
| private String genre; | |
| private String artist; | |
| public Song(String genre, String artist) { | |
| this.genre = genre; | |
| this.artist = artist; | |
| } | |
| // Getter setter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { tap } from "rxjs/operators"; | |
| import { zip } from "rxjs"; | |
| function getUser(id) { | |
| return fetch(`https://jsonplaceholder.typicode.com/users/${id}`).then(res => | |
| res.json() | |
| ); | |
| } | |
| function getPost(userId) { |
NewerOlder