@hyext/types-ext-sdk-hy 4.1.3-beta.7 → 4.2.0-beta.1

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.
Files changed (2) hide show
  1. package/index.d.ts +214 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -203,6 +203,29 @@ namespace storage {
203
203
  * @returns 调用结果
204
204
  */
205
205
  function getKeys(): Promise<StorageKeys>;
206
+ /**
207
+ * 清理本地数据缓存。
208
+ */
209
+ function clearStorage(): Promise<void>;
210
+ /**
211
+ * 从本地缓存中异步获取指定 key 的内容
212
+ * @param params - 传入参数
213
+ */
214
+ function getStorage(params: GetStorageReq): Promise<StorageRsp>;
215
+ /**
216
+ * 异步获取当前storage的相关信息。
217
+ */
218
+ function getStorageInfo(): Promise<GetSorageInfoRsp>;
219
+ /**
220
+ * 从本地缓存中移除指定 key
221
+ * @param params - 传入参数
222
+ */
223
+ function removeStorage(params: RemoveStorageReq): void;
224
+ /**
225
+ * 将数据存储在本地缓存中指定的 key 中, 会覆盖掉原来该 key 对应的内容
226
+ * @param params - 传入参数
227
+ */
228
+ function setStorage(params: SetStorageReq): Promise<void>;
206
229
  }
207
230
 
208
231
  /**
@@ -3983,6 +4006,10 @@ namespace device {
3983
4006
  * @param [params] - 输入参数
3984
4007
  */
3985
4008
  function lockOrientation(params?: LockOrientationReq): Promise<void>;
4009
+ /**
4010
+ * 获取系统信息
4011
+ */
4012
+ function getSystemInfo(): Promise<SystemInfo>;
3986
4013
  }
3987
4014
 
3988
4015
  /**
@@ -4324,6 +4351,54 @@ type LockOrientationReq = {
4324
4351
  enable: boolean;
4325
4352
  };
4326
4353
 
4354
+ /**
4355
+ * 锁定横或竖屏传入参数
4356
+ * @property appId - 宿主 app 对应的 appId
4357
+ */
4358
+ type HostInfo = {
4359
+ appId: string;
4360
+ };
4361
+
4362
+ /**
4363
+ * 窗口信息
4364
+ * @property brand - 设备品牌
4365
+ * @property model - 设备型号
4366
+ * @property pixelRatio - 设备像素比
4367
+ * @property screenWidth - 屏幕宽度,单位px
4368
+ * @property screenHeight - 屏幕高度,单位px
4369
+ * @property windowWidth - 可使用窗口宽度,单位px
4370
+ * @property windowHeight - 可使用窗口高度,单位px
4371
+ * @property statusBarHeight - 状态栏的高度,单位px
4372
+ * @property language - 设置的语言
4373
+ * @property version - 虎牙版本号
4374
+ * @property system - 操作系统及版本
4375
+ * @property platform - 客户端平台枚举, 值为:ios | android | ohos | windows | mac
4376
+ * @property fontSizeSetting - 用户字体大小(单位px)
4377
+ * @property SDKVersion - 客户端基础库版本
4378
+ * @property safeArea - 在竖屏正方向下的安全区域。部分机型没有安全区域概念,也不会返回 safeArea 字段,开发者需自行兼容。
4379
+ * @property deviceOrientation - 设备方向,值为:portrait | landscape
4380
+ * @property host - 当前小程序运行的宿主环境信息
4381
+ */
4382
+ type SystemInfo = {
4383
+ brand: string;
4384
+ model: string;
4385
+ pixelRatio: number;
4386
+ screenWidth: number;
4387
+ screenHeight: number;
4388
+ windowWidth: number;
4389
+ windowHeight: number;
4390
+ statusBarHeight: number;
4391
+ language: string;
4392
+ version: string;
4393
+ system: string;
4394
+ platform: string;
4395
+ fontSizeSetting: number;
4396
+ SDKVersion: string;
4397
+ safeArea: SafeArea;
4398
+ deviceOrientation: string;
4399
+ host: HostInfo;
4400
+ };
4401
+
4327
4402
  /**
4328
4403
  * 逐步废弃
4329
4404
  */
@@ -4372,6 +4447,14 @@ namespace env {
4372
4447
  * 取消监听来源数据变化
4373
4448
  */
4374
4449
  function offSourceDataChange(): Promise<void>;
4450
+ /**
4451
+ * 同步获取冷启动时的参数
4452
+ */
4453
+ function getLaunchOptionsSync(): LaunchOptions;
4454
+ /**
4455
+ * 获取网络类型
4456
+ */
4457
+ function getNetworkType(): Promise<NetworkTypeRsp>;
4375
4458
  }
4376
4459
 
4377
4460
  /**
@@ -4567,6 +4650,39 @@ type OnSourceDataChangeReq = {
4567
4650
  callback: SourceDataChangeCallback;
4568
4651
  };
4569
4652
 
4653
+ /**
4654
+ * @property appId - 来源小程序或 App 的 appId
4655
+ * @property extraData - 来源小程序传过来的数据
4656
+ */
4657
+ type ReferrerInfo = {
4658
+ appId: number;
4659
+ extraData: Map;
4660
+ };
4661
+
4662
+ /**
4663
+ * @property scene - 启动小游戏的场景值,其值为:1000
4664
+ * @property query - 启动小游戏的 query 参数
4665
+ * @property referrerInfo - 来源信息。从另一个小程序 或 App 进入小程序时返回。否则返回 {}。
4666
+ */
4667
+ type LaunchOptions = {
4668
+ scene: number;
4669
+ query: Map;
4670
+ referrerInfo: ReferrerInfo;
4671
+ };
4672
+
4673
+ /**
4674
+ * @property networkType - 网络类型,其值为:'wifi' | '2g' | '3g' | '4g' | '5g' | 'unknown' | 'none'
4675
+ * @property signalStrength - 信号强弱,单位 dbm
4676
+ * @property hasSystemProxy - 设备是否使用了网络代理
4677
+ * @property weakNet - 是否处于弱网环境
4678
+ */
4679
+ type NetworkTypeRsp = {
4680
+ networkType: string;
4681
+ signalStrength: number;
4682
+ hasSystemProxy: boolean;
4683
+ weakNet: boolean;
4684
+ };
4685
+
4570
4686
  /**
4571
4687
  * EXE加工相关
4572
4688
  */
@@ -8691,6 +8807,104 @@ type RaiseCaptchaReq = {
8691
8807
 
8692
8808
  type sentryTags = any;
8693
8809
 
8810
+ /**
8811
+ * 服务端持久化
8812
+ */
8813
+ namespace storage {
8814
+ /**
8815
+ * 获取存储信息
8816
+ * @param key - 存储的键
8817
+ * @returns 返回存储信息
8818
+ */
8819
+ function getItem(key: string): Promise<string>;
8820
+ /**
8821
+ * 设置存储信息
8822
+ * @param key - 存储的键
8823
+ * @param value - 存储的值
8824
+ * @returns 调用结果
8825
+ */
8826
+ function setItem(key: string, value: string): Promise<void>;
8827
+ /**
8828
+ * 移除存储信息
8829
+ * @param key - 存储的键
8830
+ * @returns 调用结果
8831
+ */
8832
+ function removeItem(key: string): Promise<void>;
8833
+ /**
8834
+ * 获取所有存储的键
8835
+ * @returns 调用结果
8836
+ */
8837
+ function getKeys(): Promise<StorageKeys>;
8838
+ /**
8839
+ * 清理本地数据缓存。
8840
+ */
8841
+ function clearStorage(): Promise<void>;
8842
+ /**
8843
+ * 从本地缓存中异步获取指定 key 的内容
8844
+ * @param params - 传入参数
8845
+ */
8846
+ function getStorage(params: GetStorageReq): Promise<StorageRsp>;
8847
+ /**
8848
+ * 异步获取当前storage的相关信息。
8849
+ */
8850
+ function getStorageInfo(): Promise<GetSorageInfoRsp>;
8851
+ /**
8852
+ * 从本地缓存中移除指定 key
8853
+ * @param params - 传入参数
8854
+ */
8855
+ function removeStorage(params: RemoveStorageReq): void;
8856
+ /**
8857
+ * 将数据存储在本地缓存中指定的 key 中, 会覆盖掉原来该 key 对应的内容
8858
+ * @param params - 传入参数
8859
+ */
8860
+ function setStorage(params: SetStorageReq): Promise<void>;
8861
+ }
8862
+
8863
+ /**
8864
+ * @property data - 需要存储的内容。只支持原生类型、Date、及能够通过JSON.stringify序列化的对象
8865
+ */
8866
+ type StorageRsp = {
8867
+ data: any;
8868
+ };
8869
+
8870
+ /**
8871
+ * @property key - 本地缓存中指定的 key
8872
+ * @property encrypt - 是否开启加密存储,默认为false
8873
+ */
8874
+ type GetStorageReq = {
8875
+ key: string;
8876
+ encrypt: boolean;
8877
+ };
8878
+
8879
+ /**
8880
+ * @property keys - 当前 storage 中所有的 key
8881
+ * @property currentSize - 是否开启加密存储,默认为false
8882
+ * @property limitSize - 限制的空间大小,单位 KB
8883
+ */
8884
+ type GetSorageInfoRsp = {
8885
+ keys: string[];
8886
+ currentSize: number;
8887
+ limitSize: number;
8888
+ };
8889
+
8890
+ /**
8891
+ * @property key - 本地缓存中指定的 key
8892
+ */
8893
+ type RemoveStorageReq = {
8894
+ key: string;
8895
+ };
8896
+
8897
+ /**
8898
+ * @property key - 本地缓存中指定的 key
8899
+ * @property data - 需要存储的内容。只支持原生类型、Date、及能够通过JSON.stringify序列化的对象
8900
+ * @property encrypt - 是否开启加密存储,默认为false
8901
+ */
8902
+ type SetStorageReq = {
8903
+ key: string;
8904
+ data: any;
8905
+ encrypt: boolean;
8906
+ };
8907
+
8694
8908
  /**
8695
8909
  * 流模块
8696
8910
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyext/types-ext-sdk-hy",
3
- "version": "4.1.3-beta.7",
3
+ "version": "4.2.0-beta.1",
4
4
  "description": "TypeScript definitions for sdk",
5
5
  "types": "./index.d.ts",
6
6
  "main": "",