diff --git a/packages/taro-h5/__tests__/location/index.test.ts b/packages/taro-h5/__tests__/location/index.test.ts index 9d0018bd0388..43e4cc54cb87 100644 --- a/packages/taro-h5/__tests__/location/index.test.ts +++ b/packages/taro-h5/__tests__/location/index.test.ts @@ -61,7 +61,7 @@ describe('location', () => { test('should get location info object from w3c api', () => { // @ts-ignore navigator.geolocation = { - getCurrentPosition (successCallback, errorCallback, optiosns) { + getCurrentPosition (successCallback) { successCallback(mockW3CGetLocationResult as GeolocationPosition) } } diff --git a/packages/taro-h5/src/api/utils/index.ts b/packages/taro-h5/src/api/utils/index.ts index ed46fc5d4c6f..4a8f556827bb 100644 --- a/packages/taro-h5/src/api/utils/index.ts +++ b/packages/taro-h5/src/api/utils/index.ts @@ -119,7 +119,7 @@ export function weixinCorpSupport (apiName) { } } -export function permanentlyNotSupport(apiName) { +export function permanentlyNotSupport (apiName) { return () => { const errMsg = `不支持 API ${apiName}` if (process.env.NODE_ENV !== 'production') { @@ -151,29 +151,26 @@ export interface IOpenApi { } class W3cApiRegistry { - apis: Map = new Map() + apis: Map = new Map() - public register(apis: Array<{ apiName: String, processApi: IOpenApi }>) { + public register (apis: Array<{ apiName: string, processApi: IOpenApi }>) { apis.forEach(e => { this.apis.set(e.apiName, e.processApi) }) } - } const w3cApiRegistry = new W3cApiRegistry() export { w3cApiRegistry } -export function processOpenApi(apiName: string, defaultOptions?: Record, formatResult = res => res, formatParams = options => options) { - +export function processOpenApi (apiName: string, defaultOptions?: Record, formatResult = res => res, formatParams = options => options) { return options => { - - //默认绑定为微信JS-SDK实现 + // 默认绑定为微信JS-SDK实现 // @ts-ignore let targetApi - //非JS-SDK环境下切换为w3c实现 + // 非JS-SDK环境下切换为w3c实现 // @ts-ignore if (window.wx) { // @ts-ignore