Skip to content

Commit 9c7bd83

Browse files
Merge branch 'main' into development
2 parents 014d207 + 7b878ff commit 9c7bd83

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/outsystems-wrapper/src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ class OSGeolocation {
106106
}
107107
error(e)
108108
}
109+
const watchAddedCallback = (callbackId: string) => {
110+
this.#callbackIdsMap[watchId] = callbackId;
111+
}
109112

110113
if (options.timeout !== Infinity) {
111114
// If the timeout value was not set to Infinity (default), then
@@ -120,7 +123,7 @@ class OSGeolocation {
120123
// For the case of watch location, capacitor returns a callback id that should be stored on the wrapper to make sure watches are cleared properly
121124
// So in other words, Synapse can't be used in watchPosition for Capacitor.
122125
// @ts-ignore
123-
let callbackId: string = Capacitor.Plugins.Geolocation.watchPosition(
126+
Capacitor.Plugins.Geolocation.watchPosition(
124127
options,
125128
(position: Position | OSGLOCPosition, err?: any) => {
126129
if (err) {
@@ -130,8 +133,7 @@ class OSGeolocation {
130133
successCallback(position)
131134
}
132135
}
133-
);
134-
this.#callbackIdsMap[watchId] = callbackId;
136+
).then(watchAddedCallback);
135137
} else {
136138
// @ts-ignore
137139
cordova.plugins.Geolocation.watchPosition(options, successCallback, errorCallback)

0 commit comments

Comments
 (0)