@ray-js/api 1.4.51 → 1.4.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -97,7 +97,7 @@ declare namespace ty {
97
97
  export function stopAccelerometer(params?: {
98
98
  complete?: () => void
99
99
  success?: (params: null) => void
100
- failure?: (params: {
100
+ fail?: (params: {
101
101
  errorMsg: string
102
102
  errorCode: string | number
103
103
  innerError: {
@@ -115,7 +115,7 @@ declare namespace ty {
115
115
  interval?: keyof typeof AccelerometerInterval
116
116
  complete?: () => void
117
117
  success?: (params: null) => void
118
- failure?: (params: {
118
+ fail?: (params: {
119
119
  errorMsg: string
120
120
  errorCode: string | number
121
121
  innerError: {
@@ -238,7 +238,7 @@ declare namespace ty {
238
238
  export function startCompass(params?: {
239
239
  complete?: () => void
240
240
  success?: (params: null) => void
241
- failure?: (params: {
241
+ fail?: (params: {
242
242
  errorMsg: string
243
243
  errorCode: string | number
244
244
  innerError: {
@@ -254,7 +254,7 @@ declare namespace ty {
254
254
  export function stopCompass(params?: {
255
255
  complete?: () => void
256
256
  success?: (params: null) => void
257
- failure?: (params: {
257
+ fail?: (params: {
258
258
  errorMsg: string
259
259
  errorCode: string | number
260
260
  innerError: {
@@ -272,7 +272,7 @@ declare namespace ty {
272
272
  interval?: keyof typeof DeviceMotionInterval
273
273
  complete?: () => void
274
274
  success?: (params: null) => void
275
- failure?: (params: {
275
+ fail?: (params: {
276
276
  errorMsg: string
277
277
  errorCode: string | number
278
278
  innerError: {
@@ -288,7 +288,7 @@ declare namespace ty {
288
288
  export function stopDeviceMotionListening(params?: {
289
289
  complete?: () => void
290
290
  success?: (params: null) => void
291
- failure?: (params: {
291
+ fail?: (params: {
292
292
  errorMsg: string
293
293
  errorCode: string | number
294
294
  innerError: {
@@ -325,7 +325,7 @@ declare namespace ty {
325
325
  interval?: keyof typeof GyroscopeInterval
326
326
  complete?: () => void
327
327
  success?: (params: null) => void
328
- failure?: (params: {
328
+ fail?: (params: {
329
329
  errorMsg: string
330
330
  errorCode: string | number
331
331
  innerError: {
@@ -341,7 +341,7 @@ declare namespace ty {
341
341
  export function stopGyroscope(params?: {
342
342
  complete?: () => void
343
343
  success?: (params: null) => void
344
- failure?: (params: {
344
+ fail?: (params: {
345
345
  errorMsg: string
346
346
  errorCode: string | number
347
347
  innerError: {
@@ -2704,7 +2704,7 @@ declare namespace ty {
2704
2704
  abort(params: {
2705
2705
  complete?: () => void
2706
2706
  success?: (params: null) => void
2707
- failure?: (params: {
2707
+ fail?: (params: {
2708
2708
  errorMsg: string
2709
2709
  errorCode: string | number
2710
2710
  innerError: {
@@ -2790,7 +2790,7 @@ declare namespace ty {
2790
2790
  /** 网络请求过程中一些调试信息 */
2791
2791
  profile: Profile
2792
2792
  }) => void
2793
- failure?: (params: {
2793
+ fail?: (params: {
2794
2794
  errorMsg: string
2795
2795
  errorCode: string | number
2796
2796
  innerError: {
@@ -3051,7 +3051,7 @@ declare namespace ty {
3051
3051
  abort(params: {
3052
3052
  complete?: () => void
3053
3053
  success?: (params: null) => void
3054
- failure?: (params: {
3054
+ fail?: (params: {
3055
3055
  errorMsg: string
3056
3056
  errorCode: string | number
3057
3057
  innerError: {
@@ -3121,7 +3121,7 @@ declare namespace ty {
3121
3121
  /** 网络请求id,用户取消、监听等操作 */
3122
3122
  taskId: string
3123
3123
  }) => void
3124
- failure?: (params: {
3124
+ fail?: (params: {
3125
3125
  errorMsg: string
3126
3126
  errorCode: string | number
3127
3127
  innerError: {
@@ -3158,7 +3158,7 @@ declare namespace ty {
3158
3158
  /** 录音文件的临时路径 (本地路径) */
3159
3159
  tempFilePath: string
3160
3160
  }) => void
3161
- failure?: (params: {
3161
+ fail?: (params: {
3162
3162
  errorMsg: string
3163
3163
  errorCode: string | number
3164
3164
  innerError: {
@@ -3177,7 +3177,7 @@ declare namespace ty {
3177
3177
  /** 录音文件的临时路径 (本地路径) */
3178
3178
  tempFilePath: string
3179
3179
  }) => void
3180
- failure?: (params: {
3180
+ fail?: (params: {
3181
3181
  errorMsg: string
3182
3182
  errorCode: string | number
3183
3183
  innerError: {
@@ -3196,7 +3196,7 @@ declare namespace ty {
3196
3196
  /** 录音文件的临时路径 (本地路径) */
3197
3197
  tempFilePath: string
3198
3198
  }) => void
3199
- failure?: (params: {
3199
+ fail?: (params: {
3200
3200
  errorMsg: string
3201
3201
  errorCode: string | number
3202
3202
  innerError: {
@@ -3215,7 +3215,7 @@ declare namespace ty {
3215
3215
  /** 录音文件的临时路径 (本地路径) */
3216
3216
  tempFilePath: string
3217
3217
  }) => void
3218
- failure?: (params: {
3218
+ fail?: (params: {
3219
3219
  errorMsg: string
3220
3220
  errorCode: string | number
3221
3221
  innerError: {
@@ -3233,7 +3233,7 @@ declare namespace ty {
3233
3233
  period: number
3234
3234
  complete?: () => void
3235
3235
  success?: (params: null) => void
3236
- failure?: (params: {
3236
+ fail?: (params: {
3237
3237
  errorMsg: string
3238
3238
  errorCode: string | number
3239
3239
  innerError: {
@@ -3249,7 +3249,7 @@ declare namespace ty {
3249
3249
  stopRecording(params: {
3250
3250
  complete?: () => void
3251
3251
  success?: (params: null) => void
3252
- failure?: (params: {
3252
+ fail?: (params: {
3253
3253
  errorMsg: string
3254
3254
  errorCode: string | number
3255
3255
  innerError: {
@@ -3262,7 +3262,7 @@ declare namespace ty {
3262
3262
  export function getRecorderManager(params?: {
3263
3263
  complete?: () => void
3264
3264
  success?: (params: null) => void
3265
- failure?: (params: {
3265
+ fail?: (params: {
3266
3266
  errorMsg: string
3267
3267
  errorCode: string | number
3268
3268
  innerError: {
@@ -3282,7 +3282,7 @@ declare namespace ty {
3282
3282
  abort(params: {
3283
3283
  complete?: () => void
3284
3284
  success?: (params: null) => void
3285
- failure?: (params: {
3285
+ fail?: (params: {
3286
3286
  errorMsg: string
3287
3287
  errorCode: string | number
3288
3288
  innerError: {
@@ -3368,7 +3368,7 @@ declare namespace ty {
3368
3368
  /** 开发者服务器返回的 HTTP 状态码 */
3369
3369
  statusCode: number
3370
3370
  }) => void
3371
- failure?: (params: {
3371
+ fail?: (params: {
3372
3372
  errorMsg: string
3373
3373
  errorCode: string | number
3374
3374
  innerError: {
@@ -892,7 +892,7 @@ declare namespace ty {
892
892
  /** 是否是临时用户 */
893
893
  isTemporaryUser: boolean
894
894
  }) => void
895
- failure?: (params: {
895
+ fail?: (params: {
896
896
  errorMsg: string
897
897
  errorCode: string | number
898
898
  innerError: {
@@ -991,7 +991,7 @@ declare namespace ty {
991
991
  /** 当前版本是否可用 */
992
992
  result: boolean
993
993
  }) => void
994
- failure?: (params: {
994
+ fail?: (params: {
995
995
  errorMsg: string
996
996
  errorCode: string | number
997
997
  innerError: {
@@ -60,8 +60,8 @@ interface CreateAnimationProps {
60
60
 
61
61
  interface NodesRef {
62
62
  fields(e: any, t: any): SelectorQuery
63
- boundingClientRect(e: any): SelectorQuery
64
- scrollOffset(e: any): SelectorQuery
63
+ boundingClientRect(e?: any): SelectorQuery
64
+ scrollOffset(e?: any): SelectorQuery
65
65
  }
66
66
  interface SelectorQuery {
67
67
  select: (e: any) => NodesRef
@@ -280,7 +280,7 @@ declare namespace ty {
280
280
  export function createMapContext(mapId: string): MapContext
281
281
  export function createIpcPlayerContext(deviceId: string): IpcContext
282
282
  export function createCameraContext(): CameraContext
283
- export function createWebviewContext(): WebviewContext
283
+ export function createWebviewContext(mapId: string): WebviewContext
284
284
  export type env = {
285
285
  USER_DATA_PATH: string
286
286
  }
@@ -1,3 +1,4 @@
1
+ import { UrlObject } from 'query-string';
1
2
  type Opts = {
2
3
  deprecated?: boolean;
3
4
  namespace?: string;
@@ -7,4 +8,6 @@ export declare function factory(name: string, opts?: Opts): (option: {
7
8
  data?: any;
8
9
  }) => any;
9
10
  export declare function factoryContants(name: string, opts?: Opts): any;
11
+ export declare const parseUrl: (url: string) => import("query-string").ParsedUrl;
12
+ export declare const stringifyUrl: (object: UrlObject) => string;
10
13
  export {};
@@ -1,5 +1,6 @@
1
1
  // @ts-ignore
2
2
  import * as tyWx from '@ray-js/wechat';
3
+ import { stringifyUrl as _stringifyUrl, parseUrl as _parseUrl } from 'query-string';
3
4
  export function factory(name) {
4
5
  let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5
6
  if (/(set|get|remove|clear)+Storage(Sync)?$/.test(name)) {
@@ -38,4 +39,19 @@ export function factoryContants(name) {
38
39
  return;
39
40
  }
40
41
  return inst[name];
41
- }
42
+ }
43
+ export const parseUrl = url => {
44
+ return _parseUrl(url, {
45
+ arrayFormat: 'bracket',
46
+ // WARN: 这里的参数与微信不一致, 但是无法进行修改了, 存量的项目已经在使用
47
+ // 例如 url=encodeURIComponent('https://www.baidu.com?name=1&age=2') 在微信中不会进行 decode
48
+ // 而在涂鸦小程序上会进行 decode, 这里是需要注意的地方
49
+ decode: true
50
+ });
51
+ };
52
+ export const stringifyUrl = object => {
53
+ return _stringifyUrl(object, {
54
+ arrayFormat: 'bracket',
55
+ encode: true
56
+ });
57
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/api",
3
- "version": "1.4.51",
3
+ "version": "1.4.53",
4
4
  "description": "Ray universal api",
5
5
  "keywords": [
6
6
  "ray"
@@ -29,14 +29,14 @@
29
29
  "watch": "ray start --type=component"
30
30
  },
31
31
  "dependencies": {
32
- "@ray-js/framework": "1.4.51",
33
- "@ray-js/router": "1.4.51",
32
+ "@ray-js/framework": "1.4.53",
33
+ "@ray-js/router": "1.4.53",
34
34
  "@ray-js/wechat": "^0.2.8",
35
35
  "base64-browser": "^1.0.1",
36
36
  "query-string": "^7.1.3"
37
37
  },
38
38
  "devDependencies": {
39
- "@ray-js/cli": "1.4.51",
39
+ "@ray-js/cli": "1.4.53",
40
40
  "art-template": "^4.13.2",
41
41
  "fs-extra": "^10.1.0",
42
42
  "miniprogram-api-typings": "^3.12.2",
@@ -46,5 +46,5 @@
46
46
  "access": "public",
47
47
  "registry": "https://registry.npmjs.org"
48
48
  },
49
- "gitHead": "ef52059911e6d19ffadedbcc1cebb2c1b8e843bc"
49
+ "gitHead": "e995833efdbe1d0537e4255c3e20cf15d7121dfb"
50
50
  }