"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Functional_1 = require("../../../../../Class/Functional");
const _ids_1 = require("../../../../_ids");
class Geolocation extends Functional_1.Functional {
    constructor(system) {
        super({
            i: ['any'],
            o: ['position'],
        }, {}, system, _ids_1.ID_GEOLOCATION);
    }
    async f({ any }, done, fail) {
        const { api: { geolocation: { getCurrentPosition }, }, } = this.__system;
        let position;
        try {
            position = await getCurrentPosition();
        }
        catch (err) {
            fail(err.message);
            return;
        }
        done({ position });
    }
}
exports.default = Geolocation;
//# sourceMappingURL=index.js.map