forked from Blendman974/faceclaw
Port Compass to iOS
This commit is contained in:
1 parent
5ae2c245c6
commit
2b3e068a23
32 files changed
+490
-56
No files matched your search
@@ -0,0 +1,14 @@
|
||||
declare const FaceclawLocation: any
|
||||
|
||||
export function restoreDeclination(_latitude: number, _longitude: number, degrees: number): number | null {
|
||||
return Number.isFinite(degrees) && Math.abs(degrees) <= 180 ? degrees : null
|
||||
}
|
||||
|
||||
export function getCurrentDeclination(): Promise<{ latitude: number; longitude: number; degrees: number }> {
|
||||
return new Promise((resolve, reject) => {
|
||||
FaceclawLocation.shared().requestDeclination((degrees: number, latitude: number, longitude: number, error: string) => {
|
||||
if (error) reject(new Error(error))
|
||||
else resolve({ degrees, latitude, longitude })
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user