UNPKG

@lifaon/rx-js-light

Version:

Blazing fast Observables

25 lines (24 loc) 962 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fromGeolocationPosition = void 0; var create_error_notification_1 = require("../../../../../../misc/notifications/built-in/error/create-error-notification.cjs"); var create_next_notification_1 = require("../../../../../../misc/notifications/built-in/next/create-next-notification.cjs"); function fromGeolocationPosition(options) { return function (emit) { var running = true; var watchId = navigator.geolocation.watchPosition(function (position) { emit((0, create_next_notification_1.createNextNotification)(position)); }, function (positionError) { emit((0, create_error_notification_1.createErrorNotification)(positionError)); }, options); return function () { if (running) { running = false; navigator.geolocation.clearWatch(watchId); } }; }; } exports.fromGeolocationPosition = fromGeolocationPosition;