import { withResolvers } from "../promise";

export type LocationType = 'wgs84' | 'gcj02';

export function getFuzzyLocation(type?: LocationType) {
  const { promise, resolve, reject } = withResolvers<WechatMiniprogram.GetFuzzyLocationSuccessCallbackResult>();
  wx.getFuzzyLocation({ type: type ?? 'gcj02', success: resolve, fail: reject });
  return promise;
}