@spcsn/taro 0.1.0
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.
- package/README.md +12 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/index.js +9 -0
- package/package.json +86 -0
- package/types/api/ad/index.d.ts +197 -0
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/inference.d.ts +129 -0
- package/types/api/ai/visionkit.d.ts +874 -0
- package/types/api/alipay/index.d.ts +69 -0
- package/types/api/base/crypto.d.ts +104 -0
- package/types/api/base/debug.d.ts +329 -0
- package/types/api/base/env.d.ts +19 -0
- package/types/api/base/index.d.ts +102 -0
- package/types/api/base/performance.d.ts +258 -0
- package/types/api/base/system.d.ts +742 -0
- package/types/api/base/update.d.ts +130 -0
- package/types/api/base/weapp/app-event.d.ts +265 -0
- package/types/api/base/weapp/life-cycle.d.ts +155 -0
- package/types/api/canvas/index.d.ts +2162 -0
- package/types/api/cloud/index.d.ts +2622 -0
- package/types/api/data-analysis/index.d.ts +122 -0
- package/types/api/device/accelerometer.d.ts +102 -0
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +46 -0
- package/types/api/device/bluetooth-ble.d.ts +601 -0
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +463 -0
- package/types/api/device/calendar.d.ts +98 -0
- package/types/api/device/clipboard.d.ts +81 -0
- package/types/api/device/compass.d.ts +105 -0
- package/types/api/device/contact.d.ts +110 -0
- package/types/api/device/gyroscope.d.ts +85 -0
- package/types/api/device/iBeacon.d.ts +168 -0
- package/types/api/device/keyboard.d.ts +97 -0
- package/types/api/device/memory.d.ts +52 -0
- package/types/api/device/motion.d.ts +88 -0
- package/types/api/device/network.d.ts +172 -0
- package/types/api/device/nfc.d.ts +1238 -0
- package/types/api/device/phone.d.ts +30 -0
- package/types/api/device/scan.d.ts +111 -0
- package/types/api/device/screen.d.ts +217 -0
- package/types/api/device/sms.d.ts +26 -0
- package/types/api/device/vibrate.d.ts +51 -0
- package/types/api/device/wifi.d.ts +301 -0
- package/types/api/ext/index.d.ts +64 -0
- package/types/api/files/index.d.ts +1472 -0
- package/types/api/framework/index.d.ts +51 -0
- package/types/api/location/index.d.ts +517 -0
- package/types/api/media/audio.d.ts +1013 -0
- package/types/api/media/background-audio.d.ts +291 -0
- package/types/api/media/camera.d.ts +207 -0
- package/types/api/media/editor.d.ts +239 -0
- package/types/api/media/image.d.ts +469 -0
- package/types/api/media/live.d.ts +461 -0
- package/types/api/media/map.d.ts +638 -0
- package/types/api/media/media-recorder.d.ts +117 -0
- package/types/api/media/recorder.d.ts +317 -0
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +84 -0
- package/types/api/media/video.d.ts +527 -0
- package/types/api/media/voip.d.ts +393 -0
- package/types/api/navigate/index.d.ts +327 -0
- package/types/api/network/download.d.ts +173 -0
- package/types/api/network/mdns.d.ts +191 -0
- package/types/api/network/request.d.ts +480 -0
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +218 -0
- package/types/api/network/upload.d.ts +201 -0
- package/types/api/network/websocket.d.ts +383 -0
- package/types/api/open-api/account.d.ts +51 -0
- package/types/api/open-api/address.d.ts +68 -0
- package/types/api/open-api/authorize.d.ts +80 -0
- package/types/api/open-api/card.d.ts +110 -0
- package/types/api/open-api/channels.d.ts +225 -0
- package/types/api/open-api/customer-service.d.ts +45 -0
- package/types/api/open-api/device-voip.d.ts +103 -0
- package/types/api/open-api/facial.d.ts +98 -0
- package/types/api/open-api/favorites.d.ts +101 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +87 -0
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +115 -0
- package/types/api/open-api/my-miniprogram.d.ts +28 -0
- package/types/api/open-api/privacy.d.ts +107 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +174 -0
- package/types/api/open-api/soter.d.ts +184 -0
- package/types/api/open-api/sticker.d.ts +83 -0
- package/types/api/open-api/subscribe-message.d.ts +305 -0
- package/types/api/open-api/user-info.d.ts +182 -0
- package/types/api/open-api/werun.d.ts +101 -0
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/qq/index.d.ts +354 -0
- package/types/api/route/index.d.ts +324 -0
- package/types/api/share/index.d.ts +354 -0
- package/types/api/skyline/index.d.ts +345 -0
- package/types/api/storage/background-fetch.d.ts +131 -0
- package/types/api/storage/cache-manager.d.ts +249 -0
- package/types/api/storage/index.d.ts +405 -0
- package/types/api/swan/bookshelf.d.ts +307 -0
- package/types/api/swan/download-package.d.ts +80 -0
- package/types/api/swan/index.d.ts +251 -0
- package/types/api/swan/pay.d.ts +139 -0
- package/types/api/taro.extend.d.ts +233 -0
- package/types/api/taro.hooks.d.ts +148 -0
- package/types/api/ui/animation.d.ts +427 -0
- package/types/api/ui/background.d.ts +69 -0
- package/types/api/ui/custom-component.d.ts +23 -0
- package/types/api/ui/fonts.d.ts +77 -0
- package/types/api/ui/interaction.d.ts +281 -0
- package/types/api/ui/menu.d.ts +29 -0
- package/types/api/ui/navigation-bar.d.ts +130 -0
- package/types/api/ui/pull-down-refresh.d.ts +50 -0
- package/types/api/ui/scroll.d.ts +114 -0
- package/types/api/ui/sticky.d.ts +32 -0
- package/types/api/ui/tab-bar.d.ts +196 -0
- package/types/api/ui/window.d.ts +71 -0
- package/types/api/worker/index.d.ts +83 -0
- package/types/api/wxml/index.d.ts +540 -0
- package/types/compile/compiler.d.ts +32 -0
- package/types/compile/config/h5.d.ts +134 -0
- package/types/compile/config/harmony.d.ts +118 -0
- package/types/compile/config/index.d.ts +8 -0
- package/types/compile/config/manifest.d.ts +155 -0
- package/types/compile/config/mini.d.ts +118 -0
- package/types/compile/config/plugin.d.ts +34 -0
- package/types/compile/config/project.d.ts +338 -0
- package/types/compile/config/rn.d.ts +85 -0
- package/types/compile/config/util.d.ts +179 -0
- package/types/compile/hooks.d.ts +13 -0
- package/types/compile/index.d.ts +11 -0
- package/types/compile/viteCompilerContext.d.ts +167 -0
- package/types/global.d.ts +428 -0
- package/types/index.d.ts +190 -0
- package/types/taro.api.d.ts +130 -0
- package/types/taro.component.d.ts +168 -0
- package/types/taro.config.d.ts +712 -0
- package/types/taro.lifecycle.d.ts +220 -0
- package/types/taro.runtime.d.ts +9 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { RecursiveTemplate, UnRecursiveTemplate } from '@spcsn/taro-shared/dist/template'
|
|
2
|
+
|
|
3
|
+
import type { PluginContext } from 'rollup'
|
|
4
|
+
import type { IMiniFilesConfig, IH5Config, IHarmonyConfig, IMiniAppConfig } from './config'
|
|
5
|
+
import type { IProjectConfig } from './config/project'
|
|
6
|
+
import type { IComponentConfig } from './hooks'
|
|
7
|
+
import type { IFileType } from './index'
|
|
8
|
+
import type { AppConfig, PageConfig } from '../index'
|
|
9
|
+
|
|
10
|
+
export interface ViteNativeCompMeta {
|
|
11
|
+
name: string
|
|
12
|
+
exportName: string
|
|
13
|
+
scriptPath: string
|
|
14
|
+
configPath: string
|
|
15
|
+
config: PageConfig
|
|
16
|
+
isNative: true
|
|
17
|
+
templatePath: string
|
|
18
|
+
cssPath?: string
|
|
19
|
+
isPackage?: boolean
|
|
20
|
+
isGenerated?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ViteFileType {
|
|
24
|
+
config: string
|
|
25
|
+
script: string
|
|
26
|
+
templ: string
|
|
27
|
+
style: string
|
|
28
|
+
xs?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ViteAppMeta {
|
|
32
|
+
name: string
|
|
33
|
+
scriptPath: string
|
|
34
|
+
configPath: string
|
|
35
|
+
config: AppConfig
|
|
36
|
+
isNative: false
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface VitePageMeta {
|
|
40
|
+
name: string
|
|
41
|
+
scriptPath: string
|
|
42
|
+
configPath: string
|
|
43
|
+
config: PageConfig
|
|
44
|
+
isNative: boolean
|
|
45
|
+
templatePath?: string
|
|
46
|
+
cssPath?: string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ViteH5BuildConfig extends CommonBuildConfig, IH5Config<'vite'> {
|
|
50
|
+
entryFileName?: string
|
|
51
|
+
runtimePath?: string | string[]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface ViteHarmonyBuildConfig extends CommonBuildConfig, IHarmonyConfig {
|
|
55
|
+
fileType: IFileType
|
|
56
|
+
useETS?: boolean
|
|
57
|
+
useJSON5?: boolean
|
|
58
|
+
blended?: boolean
|
|
59
|
+
runtimePath?: string | string[]
|
|
60
|
+
isPure?: boolean
|
|
61
|
+
taroComponentsPath: string
|
|
62
|
+
cssVariables?: boolean // 是否动态解析css变量
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface CommonBuildConfig extends IProjectConfig<'vite'> {
|
|
66
|
+
entry: {
|
|
67
|
+
app: string | string[]
|
|
68
|
+
}
|
|
69
|
+
mode: 'production' | 'development' | 'none'
|
|
70
|
+
buildAdapter: string // weapp | swan | alipay | tt | qq | jd | h5
|
|
71
|
+
platformType: string // mini | web
|
|
72
|
+
/** special mode */
|
|
73
|
+
isBuildNativeComp?: boolean
|
|
74
|
+
/** hooks */
|
|
75
|
+
onCompilerMake: (compilation) => Promise<any>
|
|
76
|
+
onParseCreateElement: (nodeName, componentConfig) => Promise<any>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
export interface ViteMiniBuildConfig extends CommonBuildConfig, IMiniAppConfig<'vite'> {
|
|
81
|
+
isBuildPlugin: boolean
|
|
82
|
+
isSupportRecursive: boolean
|
|
83
|
+
isSupportXS: boolean
|
|
84
|
+
nodeModulesPath: string
|
|
85
|
+
fileType: ViteFileType
|
|
86
|
+
globalObject: string
|
|
87
|
+
template: RecursiveTemplate | UnRecursiveTemplate
|
|
88
|
+
runtimePath?: string | string[]
|
|
89
|
+
taroComponentsPath: string
|
|
90
|
+
blended?: boolean
|
|
91
|
+
hot?: boolean
|
|
92
|
+
injectOptions?: {
|
|
93
|
+
include?: Record<string, string | string[]>
|
|
94
|
+
exclude?: string[]
|
|
95
|
+
}
|
|
96
|
+
/** hooks */
|
|
97
|
+
modifyComponentConfig: (componentConfig: IComponentConfig, config: Partial<ViteMiniBuildConfig>) => Promise<any>
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface ViteCompilerContext<T> {
|
|
101
|
+
cwd: string
|
|
102
|
+
sourceDir: string
|
|
103
|
+
taroConfig: T
|
|
104
|
+
rawTaroConfig: T
|
|
105
|
+
frameworkExts: string[]
|
|
106
|
+
app: ViteAppMeta
|
|
107
|
+
pages: VitePageMeta[]
|
|
108
|
+
components?: VitePageMeta[]
|
|
109
|
+
loaderMeta: any
|
|
110
|
+
logger
|
|
111
|
+
filesConfig: IMiniFilesConfig
|
|
112
|
+
configFileList: string[]
|
|
113
|
+
compilePage: (pageName: string) => VitePageMeta
|
|
114
|
+
watchConfigFile: (rollupCtx: PluginContext) => void
|
|
115
|
+
collectedDeps: (rollupCtx: PluginContext, id: string, filter, cache: Set<string> = new Set()) => Promise<Set<string>>
|
|
116
|
+
getAppScriptPath: () => string
|
|
117
|
+
getApp: () => ViteAppMeta
|
|
118
|
+
getPages: () => VitePageMeta[]
|
|
119
|
+
isApp: (id: string) => boolean
|
|
120
|
+
isPage: (id: string) => boolean
|
|
121
|
+
isComponent: (id: string) => boolean
|
|
122
|
+
isNativePageORComponent: (templatePath: string) => boolean
|
|
123
|
+
getPageById: (id: string) => VitePageMeta| undefined
|
|
124
|
+
getComponentById: (id: string) => VitePageMeta| undefined
|
|
125
|
+
getConfigFilePath: (filePath: string) => string
|
|
126
|
+
getTargetFilePath: (filePath: string, targetExtName: string) => string
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface ViteH5CompilerContext extends ViteCompilerContext<ViteH5BuildConfig> {
|
|
130
|
+
getBrowserslist: () => void
|
|
131
|
+
routerMeta: {
|
|
132
|
+
routerCreator: string
|
|
133
|
+
getRoutesConfig: (pageName?: string) => string
|
|
134
|
+
}
|
|
135
|
+
browserslist: string[]
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface ViteHarmonyCompilerContext extends ViteCompilerContext<ViteHarmonyBuildConfig> {
|
|
139
|
+
nativeExt: string[]
|
|
140
|
+
fileType: ViteFileType
|
|
141
|
+
commonChunks: string[]
|
|
142
|
+
extraComponents: string[]
|
|
143
|
+
nativeComponents : Map<string, ViteNativeCompMeta>
|
|
144
|
+
getCommonChunks: () => string[]
|
|
145
|
+
modifyHarmonyConfig: (config: Partial<AppConfig>) => void
|
|
146
|
+
modifyHostPackage: (deps?: Record<string, string>, devDeps?: Record<string, string>) => Exclude<IHarmonyConfig['ohPackage'], void>
|
|
147
|
+
resolvePageImportPath: (scriptPath: string, pageName: string) => string
|
|
148
|
+
collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => ViteNativeCompMeta[]
|
|
149
|
+
generateNativeComponent: (rollupCtx: PluginContext, meta: ViteNativeCompMeta, implicitlyLoadedAfterOneOf: string[] = []) => void
|
|
150
|
+
getScriptPath: (filePath: string) => string
|
|
151
|
+
getStylePath: (filePath: string) => string
|
|
152
|
+
getConfigPath: (filePath: string) => string
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface ViteMiniCompilerContext extends ViteCompilerContext<ViteMiniBuildConfig> {
|
|
156
|
+
fileType: ViteFileType
|
|
157
|
+
commonChunks: string[]
|
|
158
|
+
nativeComponents : Map<string, ViteNativeCompMeta>
|
|
159
|
+
getCommonChunks: () => string[]
|
|
160
|
+
resolvePageImportPath: (scriptPath: string, pageName: string) => string
|
|
161
|
+
collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => ViteNativeCompMeta[]
|
|
162
|
+
generateNativeComponent: (rollupCtx: PluginContext, meta: ViteNativeCompMeta, implicitlyLoadedAfterOneOf: string[] = []) => void
|
|
163
|
+
getScriptPath: (filePath: string) => string
|
|
164
|
+
getTemplatePath: (filePath: string) => string
|
|
165
|
+
getStylePath: (filePath: string) => string
|
|
166
|
+
getConfigPath: (filePath: string) => string
|
|
167
|
+
}
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
declare namespace TaroGeneral {
|
|
2
|
+
type IAnyObject = Record<string, any>
|
|
3
|
+
type Optional<F> = F extends (arg: infer P) => infer R ? (arg?: P) => R : F
|
|
4
|
+
type OptionalInterface<T> = { [K in keyof T]: Optional<T[K]> }
|
|
5
|
+
type TFunc = (...args: any[]) => any
|
|
6
|
+
/** 事件监听函数 */
|
|
7
|
+
type EventCallback = (
|
|
8
|
+
/** 触发事件参数 */
|
|
9
|
+
...args: any
|
|
10
|
+
) => void
|
|
11
|
+
/** 通用错误 */
|
|
12
|
+
interface CallbackResult {
|
|
13
|
+
/** 错误信息 */
|
|
14
|
+
errMsg: string
|
|
15
|
+
}
|
|
16
|
+
type CommonEventFunction<T = any> = (event: BaseEventOrig<T>) => any
|
|
17
|
+
interface BaseEventOrig<T> {
|
|
18
|
+
/** 事件类型 */
|
|
19
|
+
type: string
|
|
20
|
+
|
|
21
|
+
/** 事件生成时的时间戳 */
|
|
22
|
+
timeStamp: number
|
|
23
|
+
|
|
24
|
+
/** 触发事件的组件的一些属性值集合 */
|
|
25
|
+
target: Target
|
|
26
|
+
|
|
27
|
+
/** 当前组件的一些属性值集合 */
|
|
28
|
+
currentTarget: currentTarget
|
|
29
|
+
|
|
30
|
+
/** 额外的信息 */
|
|
31
|
+
detail: T
|
|
32
|
+
|
|
33
|
+
/** 阻止元素发生默认的行为 */
|
|
34
|
+
preventDefault: () => void
|
|
35
|
+
|
|
36
|
+
/** 阻止事件冒泡到父元素,阻止任何父事件处理程序被执行 */
|
|
37
|
+
stopPropagation: () => void
|
|
38
|
+
}
|
|
39
|
+
interface currentTarget extends Target { }
|
|
40
|
+
interface Target {
|
|
41
|
+
/** 事件源组件的id */
|
|
42
|
+
id: string
|
|
43
|
+
/** 当前组件的类型 */
|
|
44
|
+
tagName: string
|
|
45
|
+
/** 事件源组件上由data-开头的自定义属性组成的集合 */
|
|
46
|
+
dataset: {
|
|
47
|
+
[key: string]: any
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** 蓝牙错误 */
|
|
51
|
+
interface BluetoothError extends CallbackResult {
|
|
52
|
+
/** 错误信息 */
|
|
53
|
+
errMsg: string
|
|
54
|
+
/** 错误码 */
|
|
55
|
+
errCode: keyof BluetoothErrCode
|
|
56
|
+
}
|
|
57
|
+
/** WIFI 错误 */
|
|
58
|
+
interface WifiError extends CallbackResult {
|
|
59
|
+
/** 错误信息 */
|
|
60
|
+
errMsg: string
|
|
61
|
+
/** 错误码 */
|
|
62
|
+
errCode: keyof WifiErrCode
|
|
63
|
+
}
|
|
64
|
+
/** NFC 错误 */
|
|
65
|
+
interface NFCError extends CallbackResult {
|
|
66
|
+
/** 错误信息 */
|
|
67
|
+
errMsg: string
|
|
68
|
+
/** 错误码 */
|
|
69
|
+
errCode: keyof NFCErrCode
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** iBeacon 错误 */
|
|
73
|
+
interface IBeaconError extends CallbackResult {
|
|
74
|
+
/** 错误信息 */
|
|
75
|
+
errMsg: string
|
|
76
|
+
/** 错误码 */
|
|
77
|
+
errCode: keyof IBeaconErrCode
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** 在竖屏正方向下的安全区域 */
|
|
81
|
+
interface SafeAreaResult {
|
|
82
|
+
/** 安全区域右下角纵坐标 */
|
|
83
|
+
bottom: number
|
|
84
|
+
/** 安全区域的高度,单位逻辑像素 */
|
|
85
|
+
height: number
|
|
86
|
+
/** 安全区域左上角横坐标 */
|
|
87
|
+
left: number
|
|
88
|
+
/** 安全区域右下角横坐标 */
|
|
89
|
+
right: number
|
|
90
|
+
/** 安全区域左上角纵坐标 */
|
|
91
|
+
top: number
|
|
92
|
+
/** 安全区域的宽度,单位逻辑像素 */
|
|
93
|
+
width: number
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* 广告错误码
|
|
97
|
+
*
|
|
98
|
+
* 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。
|
|
99
|
+
* 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。
|
|
100
|
+
*/
|
|
101
|
+
interface AdErrCode {
|
|
102
|
+
/**
|
|
103
|
+
* @illustrate 后端接口调用失败
|
|
104
|
+
* @reason 该项错误不是开发者的异常情况
|
|
105
|
+
* @solution 一般情况下忽略一段时间即可恢复。
|
|
106
|
+
*/
|
|
107
|
+
1000
|
|
108
|
+
/**
|
|
109
|
+
* @illustrate 参数错误
|
|
110
|
+
* @reason 使用方法错误
|
|
111
|
+
* @solution 可以前往 developers.weixin.qq.com 确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。
|
|
112
|
+
*/
|
|
113
|
+
1001
|
|
114
|
+
/**
|
|
115
|
+
* @illustrate 广告单元无效
|
|
116
|
+
* @reason 可能是拼写错误、或者误用了其他APP的广告ID
|
|
117
|
+
* @solution 请重新前往 mp.weixin.qq.com 确认广告位ID。
|
|
118
|
+
*/
|
|
119
|
+
1002
|
|
120
|
+
/**
|
|
121
|
+
* @illustrate 内部错误
|
|
122
|
+
* @reason 该项错误不是开发者的异常情况
|
|
123
|
+
* @solution 一般情况下忽略一段时间即可恢复。
|
|
124
|
+
*/
|
|
125
|
+
1003
|
|
126
|
+
/**
|
|
127
|
+
* @illustrate 无合适的广告
|
|
128
|
+
* @reason 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告
|
|
129
|
+
* @solution 属于正常情况,且开发者需要针对这种情况做形态上的兼容。
|
|
130
|
+
*/
|
|
131
|
+
1004
|
|
132
|
+
/**
|
|
133
|
+
* @illustrate 广告组件审核中
|
|
134
|
+
* @reason 你的广告正在被审核,无法展现广告
|
|
135
|
+
* @solution 请前往 mp.weixin.qq.com 确认审核状态,且开发者需要针对这种情况做形态上的兼容。
|
|
136
|
+
*/
|
|
137
|
+
1005
|
|
138
|
+
/**
|
|
139
|
+
* @illustrate 广告组件被驳回
|
|
140
|
+
* @reason 你的广告审核失败,无法展现广告
|
|
141
|
+
* @solution 请前往 mp.weixin.qq.com 确认审核状态,且开发者需要针对这种情况做形态上的兼容。
|
|
142
|
+
*/
|
|
143
|
+
1006
|
|
144
|
+
/**
|
|
145
|
+
* @illustrate 广告组件被封禁
|
|
146
|
+
* @reason 你的广告能力已经被封禁,封禁期间无法展现广告
|
|
147
|
+
* @solution 请前往 mp.weixin.qq.com 确认小程序广告封禁状态。
|
|
148
|
+
*/
|
|
149
|
+
1007
|
|
150
|
+
/**
|
|
151
|
+
* @illustrate 广告单元已关闭
|
|
152
|
+
* @reason 该广告位的广告能力已经被关闭
|
|
153
|
+
* @solution 请前往 mp.weixin.qq.com 重新打开对应广告位的展现。
|
|
154
|
+
*/
|
|
155
|
+
1008
|
|
156
|
+
// [key: number]: string
|
|
157
|
+
}
|
|
158
|
+
/** 蓝牙错误码 */
|
|
159
|
+
interface BluetoothErrCode {
|
|
160
|
+
/** ok
|
|
161
|
+
* @illustrate 正常
|
|
162
|
+
*/
|
|
163
|
+
0
|
|
164
|
+
/** not init
|
|
165
|
+
* @illustrate 未初始化蓝牙适配器
|
|
166
|
+
*/
|
|
167
|
+
10000
|
|
168
|
+
/** not available
|
|
169
|
+
* @illustrate 当前蓝牙适配器不可用
|
|
170
|
+
*/
|
|
171
|
+
10001
|
|
172
|
+
/** no device
|
|
173
|
+
* @illustrate 没有找到指定设备
|
|
174
|
+
*/
|
|
175
|
+
10002
|
|
176
|
+
/** connection fail
|
|
177
|
+
* @illustrate 连接失败
|
|
178
|
+
*/
|
|
179
|
+
10003
|
|
180
|
+
/** no service
|
|
181
|
+
* @illustrate 没有找到指定服务
|
|
182
|
+
*/
|
|
183
|
+
10004
|
|
184
|
+
/** no characteristic
|
|
185
|
+
* @illustrate 没有找到指定特征值
|
|
186
|
+
*/
|
|
187
|
+
10005
|
|
188
|
+
/** no connection
|
|
189
|
+
* @illustrate 当前连接已断开
|
|
190
|
+
*/
|
|
191
|
+
10006
|
|
192
|
+
/** property not support
|
|
193
|
+
* @illustrate 当前特征值不支持此操作
|
|
194
|
+
*/
|
|
195
|
+
10007
|
|
196
|
+
/** system error
|
|
197
|
+
* @illustrate 其余所有系统上报的异常
|
|
198
|
+
*/
|
|
199
|
+
10008
|
|
200
|
+
/** system not support
|
|
201
|
+
* @illustrate Android 系统特有,系统版本低于 4.3 不支持 BLE
|
|
202
|
+
*/
|
|
203
|
+
10009
|
|
204
|
+
/** operate time out
|
|
205
|
+
* @illustrate 连接超时
|
|
206
|
+
*/
|
|
207
|
+
10012
|
|
208
|
+
/** invalid_data
|
|
209
|
+
* @illustrate 连接 deviceId 为空或者是格式不正确
|
|
210
|
+
*/
|
|
211
|
+
10013
|
|
212
|
+
}
|
|
213
|
+
/** iBeacon 错误码 */
|
|
214
|
+
interface IBeaconErrCode {
|
|
215
|
+
/** ok
|
|
216
|
+
* @illustrate 正常
|
|
217
|
+
*/
|
|
218
|
+
0
|
|
219
|
+
/** nonsupport
|
|
220
|
+
* @illustrate 系统或设备不支持
|
|
221
|
+
*/
|
|
222
|
+
11000
|
|
223
|
+
/** bluetooth service unavailable
|
|
224
|
+
* @illustrate 蓝牙服务不可用
|
|
225
|
+
*/
|
|
226
|
+
11001
|
|
227
|
+
/** location service unavailable
|
|
228
|
+
* @illustrate 位置服务不可用
|
|
229
|
+
*/
|
|
230
|
+
11002
|
|
231
|
+
/** already start
|
|
232
|
+
* @illustrate 已经开始搜索
|
|
233
|
+
*/
|
|
234
|
+
11003
|
|
235
|
+
/** not startBeaconDiscovery
|
|
236
|
+
* @illustrate 还未开始搜索
|
|
237
|
+
*/
|
|
238
|
+
11004
|
|
239
|
+
/** system error
|
|
240
|
+
* @illustrate 系统错误
|
|
241
|
+
*/
|
|
242
|
+
11005
|
|
243
|
+
/** invalid data
|
|
244
|
+
* @illustrate 参数不正确
|
|
245
|
+
*/
|
|
246
|
+
11006
|
|
247
|
+
}
|
|
248
|
+
/** WIFI 错误码 */
|
|
249
|
+
interface WifiErrCode {
|
|
250
|
+
/** ok
|
|
251
|
+
* @illustrate 正常
|
|
252
|
+
*/
|
|
253
|
+
0
|
|
254
|
+
/** not init
|
|
255
|
+
* @illustrate 未先调用 `startWifi` 接口
|
|
256
|
+
*/
|
|
257
|
+
12000
|
|
258
|
+
/** system not support
|
|
259
|
+
* @illustrate 当前系统不支持相关能力
|
|
260
|
+
*/
|
|
261
|
+
12001
|
|
262
|
+
/** password error Wi-Fi
|
|
263
|
+
* @illustrate 密码错误
|
|
264
|
+
*/
|
|
265
|
+
12002
|
|
266
|
+
/** connection timeout
|
|
267
|
+
* @illustrate 连接超时
|
|
268
|
+
*/
|
|
269
|
+
12003
|
|
270
|
+
/** duplicate request
|
|
271
|
+
* @illustrate 重复连接 Wi-Fi
|
|
272
|
+
*/
|
|
273
|
+
12004
|
|
274
|
+
/** wifi not turned on
|
|
275
|
+
* @illustrate Android 特有,未打开 Wi-Fi 开关
|
|
276
|
+
*/
|
|
277
|
+
12005
|
|
278
|
+
/** gps not turned on
|
|
279
|
+
* @illustrate Android 特有,未打开 GPS 定位开关
|
|
280
|
+
*/
|
|
281
|
+
12006
|
|
282
|
+
/** user denied
|
|
283
|
+
* @illustrate 用户拒绝授权链接 Wi-Fi
|
|
284
|
+
*/
|
|
285
|
+
12007
|
|
286
|
+
/** invalid SSID
|
|
287
|
+
* @illustrate 无效 SSID
|
|
288
|
+
*/
|
|
289
|
+
12008
|
|
290
|
+
/** system config err
|
|
291
|
+
* @illustrate 系统运营商配置拒绝连接 Wi-Fi
|
|
292
|
+
*/
|
|
293
|
+
12009
|
|
294
|
+
/** system internal error
|
|
295
|
+
* @illustrate 系统其他错误,需要在 errmsg 打印具体的错误原因
|
|
296
|
+
*/
|
|
297
|
+
12010
|
|
298
|
+
/** weapp in background
|
|
299
|
+
* @illustrate 应用在后台无法配置 Wi-Fi
|
|
300
|
+
*/
|
|
301
|
+
12011
|
|
302
|
+
/** wifi config may be expired
|
|
303
|
+
* @illustrate 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试
|
|
304
|
+
*/
|
|
305
|
+
12013
|
|
306
|
+
}
|
|
307
|
+
/** NFC 错误码 */
|
|
308
|
+
interface NFCErrCode {
|
|
309
|
+
/** ok
|
|
310
|
+
* @illustrate 正常
|
|
311
|
+
*/
|
|
312
|
+
0
|
|
313
|
+
/** @illustrate 当前设备不支持 NFC */
|
|
314
|
+
13000
|
|
315
|
+
/** @illustrate 当前设备支持 NFC,但系统 NFC 开关未开启 */
|
|
316
|
+
13001
|
|
317
|
+
/** @illustrate 当前设备支持 NFC,但不支持 HCE */
|
|
318
|
+
13002
|
|
319
|
+
/** @illustrate AID 列表参数格式错误 */
|
|
320
|
+
13003
|
|
321
|
+
/** @illustrate 未设置微信为默认 NFC 支付应用 */
|
|
322
|
+
13004
|
|
323
|
+
/** @illustrate 返回的指令不合法 */
|
|
324
|
+
13005
|
|
325
|
+
/** @illustrate 注册 AID 失败 */
|
|
326
|
+
13006
|
|
327
|
+
/** @illustrate 未知错误 */
|
|
328
|
+
13010
|
|
329
|
+
/** user is not authorized
|
|
330
|
+
* @illustrate 用户未授权
|
|
331
|
+
*/
|
|
332
|
+
13019
|
|
333
|
+
/** invalid parameter
|
|
334
|
+
* @illustrate 参数无效
|
|
335
|
+
*/
|
|
336
|
+
13011
|
|
337
|
+
/** parse NdefMessage failed
|
|
338
|
+
* @illustrate 将参数解析为 NdefMessage 失败
|
|
339
|
+
*/
|
|
340
|
+
13012
|
|
341
|
+
/** NFC tag has not been discovered
|
|
342
|
+
* @illustrate 未扫描到NFC标签
|
|
343
|
+
*/
|
|
344
|
+
13013
|
|
345
|
+
/** invalid tech
|
|
346
|
+
* @illustrate 无效的标签技术
|
|
347
|
+
*/
|
|
348
|
+
13014
|
|
349
|
+
/** unavailable tech
|
|
350
|
+
* @illustrate 从标签上获取对应技术失败
|
|
351
|
+
*/
|
|
352
|
+
13015
|
|
353
|
+
/** connect fail
|
|
354
|
+
* @illustrate 连接失败
|
|
355
|
+
*/
|
|
356
|
+
13016
|
|
357
|
+
/** system internal error
|
|
358
|
+
* @illustrate 相关读写操作失败
|
|
359
|
+
*/
|
|
360
|
+
13017
|
|
361
|
+
/** NFC discovery has not started
|
|
362
|
+
* @illustrate 尝试在未开始 NFC 扫描时停止 NFC 扫描
|
|
363
|
+
*/
|
|
364
|
+
13018
|
|
365
|
+
/** NFC discovery already started
|
|
366
|
+
* @illustrate 已经开始 NFC 扫描
|
|
367
|
+
*/
|
|
368
|
+
13021
|
|
369
|
+
/** Tech already connected
|
|
370
|
+
* @illustrate 标签已经连接
|
|
371
|
+
*/
|
|
372
|
+
13022
|
|
373
|
+
/** Tech has not connected
|
|
374
|
+
* @illustrate 尝试在未连接标签时断开连接
|
|
375
|
+
*/
|
|
376
|
+
13023
|
|
377
|
+
/** function not support
|
|
378
|
+
* @illustrate 当前标签技术不支持该功能
|
|
379
|
+
*/
|
|
380
|
+
13024
|
|
381
|
+
}
|
|
382
|
+
type EventName = string | symbol
|
|
383
|
+
// Events
|
|
384
|
+
class Events {
|
|
385
|
+
/**
|
|
386
|
+
* 监听一个事件,接受参数
|
|
387
|
+
*/
|
|
388
|
+
on (eventName: EventName, listener: (...args: any[]) => void): this
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* 添加一个事件监听,并在事件触发完成之后移除Callbacks链
|
|
392
|
+
*/
|
|
393
|
+
once (eventName: EventName, listener: (...args: any[]) => void): this
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* 取消监听一个事件
|
|
397
|
+
*/
|
|
398
|
+
off (eventName: EventName, listener?: (...args: any[]) => void): this
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* 取消监听的所有事件
|
|
402
|
+
*/
|
|
403
|
+
off (): this
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* 触发一个事件,传参
|
|
407
|
+
*/
|
|
408
|
+
trigger (eventName: EventName, ...args: any[]): this
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// ENV_TYPE
|
|
412
|
+
enum ENV_TYPE {
|
|
413
|
+
ASCF = 'ASCF',
|
|
414
|
+
WEAPP = 'WEAPP',
|
|
415
|
+
SWAN = 'SWAN',
|
|
416
|
+
ALIPAY = 'ALIPAY',
|
|
417
|
+
TT = 'TT',
|
|
418
|
+
QQ = 'QQ',
|
|
419
|
+
JD = 'JD',
|
|
420
|
+
WEB = 'WEB',
|
|
421
|
+
RN = 'RN',
|
|
422
|
+
HARMONY = 'HARMONY',
|
|
423
|
+
QUICKAPP = 'QUICKAPP',
|
|
424
|
+
HARMONYHYBRID = 'HARMONYHYBRID'
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
type TDeviceRatio = Record<string, number>
|
|
428
|
+
}
|