Skip to content

Commit f36b4f6

Browse files
authored
Merge pull request #29 from GeoTecINIT/migrate-rxjs
Migrate to RxJS 7
2 parents f753ec9 + c100faa commit f36b4f6

File tree

6 files changed

+57
-55
lines changed

6 files changed

+57
-55
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,12 @@ async function printLocationUpdates(): Promise<Subscription> {
226226
maxAge: 60000, // And filter-out old locations
227227
});
228228

229-
return stream.subscribe(
230-
(location) => {
231-
console.log(`New location acquired!: ${JSON.stringify(location)}`);
232-
},
233-
(error) =>
229+
return stream.subscribe({
230+
next: (location) =>
231+
console.log(`New location acquired!: ${JSON.stringify(location)}`),
232+
error: (error) =>
234233
console.error(`Location updates could not be acquired: ${error}`)
235-
);
234+
});
236235
}
237236
```
238237

demo/app/home/home-page.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ import { HomeViewModel } from "./home-view-model";
1111
import { contextApis } from "nativescript-context-apis";
1212
import { Resolution } from "nativescript-context-apis/activity-recognition";
1313

14-
import {
15-
GeolocationProvider,
16-
Geolocation,
17-
} from "nativescript-context-apis/geolocation";
14+
import { GeolocationProvider } from "nativescript-context-apis/geolocation";
1815
import { of, Subscription } from "rxjs";
1916

2017
const activityRecognizers = [Resolution.LOW, Resolution.MEDIUM];
@@ -83,15 +80,14 @@ async function printLocationUpdates(): Promise<Subscription> {
8380
timeout: 5000,
8481
maxAge: 60000,
8582
})
86-
: of<Geolocation>(null);
83+
: of(null);
8784

88-
return stream.subscribe(
89-
(location) => {
90-
console.log(`New location acquired!: ${JSON.stringify(location)}`);
91-
},
92-
(error) =>
85+
return stream.subscribe({
86+
next: (location) =>
87+
console.log(`New location acquired!: ${JSON.stringify(location)}`),
88+
error: (error) =>
9389
console.error(`Location updates could not be acquired: ${error}`)
94-
);
90+
});
9591
}
9692

9793
export function listenToActivityChanges(addListener = false) {

demo/package-lock.json

Lines changed: 18 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@nativescript/theme": "~2.3.0",
1111
"@nativescript/unit-test-runner": "^1.0.2",
1212
"nativescript-context-apis": "file:../src",
13-
"rxjs": "^6.5.5"
13+
"rxjs": "^7.5.5"
1414
},
1515
"devDependencies": {
1616
"@nativescript/android": "7.0.1",

src/package-lock.json

Lines changed: 25 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"@nativescript/geolocation": "^8.0.2",
6464
"@triniwiz/nativescript-couchbase": "1.2.5",
6565
"nativescript-permissions": "1.3.11",
66-
"rxjs": "^6.5.5"
66+
"rxjs": "^7.5.5"
6767
},
6868
"bootstrapper": "nativescript-plugin-seed"
6969
}

0 commit comments

Comments
 (0)