Skip to content

Commit

Permalink
fix(h5):Lint,修正代码格式
Browse files Browse the repository at this point in the history
  • Loading branch information
CaiDingxian committed Apr 13, 2022
1 parent c9c896d commit c2941fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/taro-h5/__tests__/location/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
15 changes: 6 additions & 9 deletions packages/taro-h5/src/api/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -151,29 +151,26 @@ export interface IOpenApi {
}

class W3cApiRegistry {
apis: Map<String, IOpenApi> = new Map<String, IOpenApi>()
apis: Map<string, IOpenApi> = new Map<string, IOpenApi>()

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<string, unknown>, formatResult = res => res, formatParams = options => options) {

export function processOpenApi (apiName: string, defaultOptions?: Record<string, unknown>, 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
Expand Down

0 comments on commit c2941fc

Please sign in to comment.