declare namespace VnmfGeneral { type IAnyObject = Record type Optional = F extends (arg: infer P) => infer R ? (arg?: P) => R : F type OptionalInterface = { [K in keyof T]: Optional } /** Event monitoring function */ type EventCallback = ( /** Trigger event parameters */ ...args: any ) => void /** Universal error */ interface CallbackResult { /** Error message */ errMsg: string } type CommonEventFunction = (event: BaseEventOrig) => any interface BaseEventOrig { /** Event */ type: string /** Time stamp when the event is generated */ timeStamp: number /** Some attribute values of the component of the event component */ target: Target /** Some attribute values of the current component */ currentTarget: currentTarget /** Extra information */ detail: T /** Prevent elements from default behavior */ preventDefault: () => void /** Prevent the incident from bubbling to the parent element ,Prevent any parent incident processing procedure is executed */ stopPropagation: () => void } interface currentTarget extends Target {} interface Target { /** Event source component id */ id: string /** Type of the current component */ tagName: string /** Event source component data-A collection of custom attributes at the beginning */ dataset: { [key: string]: any } } /** Bluetooth error */ interface BluetoothError extends CallbackResult { /** Error message */ errMsg: string /** error code */ errCode: keyof BluetoothErrCode } /** WIFI mistake */ interface WifiError extends CallbackResult { /** Error message */ errMsg: string /** error code */ errCode: keyof WifiErrCode } /** NFC mistake */ interface NFCError extends CallbackResult { /** Error message */ errMsg: string /** error code */ errCode: keyof NFCErrCode } /** iBeacon mistake */ interface IBeaconError extends CallbackResult { /** Error message */ errMsg: string /** error code */ errCode: keyof IBeaconErrCode } /** Safety areas under the positive direction of the vertical screen */ interface SafeAreaResult { /** The vertical coordinates in the lower right corner of the safe area */ bottom: number /** Height of the safety area ,Unit logic pixel */ height: number /** Horizontal coordinates in the upper left corner of the safety area */ left: number /** Horizontal coordinates in the lower right corner of the safe area */ right: number /** The vertical coordinates in the upper left corner of the safety area */ top: number /** Width of the safety area ,Unit logic pixel */ width: number } /** * Advertising error code * * The error code is through onErrorGet the error message 。During debugging ,You can return to capture information through abnormalities 。 * After the applet is released ,If you encounter abnormal problems ,allowable [“Operation and maintenance center “](https://mp.weixin.qq.com/)Search the wrong log in it ,You can also return to the abnormal return plus appropriate monitoring information 。 */ interface AdErrCode { /** * @illustrate Back -end interface call fails * @reason This error is not an abnormal situation of the developer * @solution Under normal circumstances, you can recover for a while 。 */ 1000 /** * @illustrate Parameter error * @reason Used error * @solution Can go developers.weixin.qq.com Confirm the specific tutorial (There are their own tutorials for mini programs and mini -games ,Can be in the top options ,“design ”Switch on the right side of the column 。 */ 1001 /** * @illustrate Advertising unit is invalid * @reason It may be a spelling error 、Or misuse others APPadvertisment ID * @solution Please go again mp.weixin.qq.com Confirm the advertising position ID。 */ 1002 /** * @illustrate internal error * @reason This error is not an abnormal situation of the developer * @solution Under normal circumstances, you can recover for a while 。 */ 1003 /** * @illustrate No suitable advertisement * @reason Advertising does not appear every time ,It may not appear this time because the user is not suitable for viewing ads * @solution Belongs to normal ,And developers need to be compatible with this situation 。 */ 1004 /** * @illustrate Advertising component review * @reason Your advertisement is being reviewed ,Can't show advertisements * @solution Please go mp.weixin.qq.com Confirm the review status ,And developers need to be compatible with this situation 。 */ 1005 /** * @illustrate Advertising components are rejected * @reason Your advertising review failed ,Can't show advertisements * @solution Please go mp.weixin.qq.com Confirm the review status ,And developers need to be compatible with this situation 。 */ 1006 /** * @illustrate Advertising components are banned * @reason Your advertising ability has been banned ,Advertising cannot be displayed during the ban period * @solution Please go mp.weixin.qq.com Confirm that small program advertisements are banned 。 */ 1007 /** * @illustrate Advertising unit has been closed * @reason The advertising capacity of this advertising position has been closed * @solution Please go mp.weixin.qq.com Open the display of the corresponding advertising position again 。 */ 1008 // [key: number]: string } /** Bluetooth error code */ interface BluetoothErrCode { /** ok * @illustrate normal */ 0 /** not init * @illustrate Not initialized Bluetooth adapter */ 10000 /** not available * @illustrate The current Bluetooth adapter is not available */ 10001 /** no device * @illustrate Didn't find the specified device */ 10002 /** connection fail * @illustrate Connection failed */ 10003 /** no service * @illustrate Did not find a specified service */ 10004 /** no characteristic * @illustrate Can't find the specified feature value */ 10005 /** no connection * @illustrate The current connection has been disconnected */ 10006 /** property not support * @illustrate The current feature value does not support this operation */ 10007 /** system error * @illustrate All the remaining systems reported abnormalities */ 10008 /** system not support * @illustrate Android System -specific ,The system version is lower than 4.3 not support BLE */ 10009 /** operate time out * @illustrate Connection timed out */ 10012 /** invalid_data * @illustrate connect deviceId For empty or the format is incorrect */ 10013 } /** iBeacon error code */ interface IBeaconErrCode { /** ok * @illustrate normal */ 0 /** nonsupport * @illustrate System or device does not support */ 11000 /** bluetooth service unavailable * @illustrate Bluetooth service is not available */ 11001 /** location service unavailable * @illustrate Location service is unavailable */ 11002 /** already start * @illustrate Already started search */ 11003 /** not startBeaconDiscovery * @illustrate No search yet */ 11004 /** system error * @illustrate system error */ 11005 /** invalid data * @illustrate The parameter is incorrect */ 11006 } /** WIFI error code */ interface WifiErrCode { /** ok * @illustrate normal */ 0 /** not init * @illustrate No call first `startWifi` interface */ 12000 /** system not support * @illustrate The current system does not support relevant capabilities */ 12001 /** password error Wi-Fi * @illustrate wrong password */ 12002 /** connection timeout * @illustrate Connection timed out */ 12003 /** duplicate request * @illustrate Repeat connection Wi-Fi */ 12004 /** wifi not turned on * @illustrate Android Unique ,Not open Wi-Fi switch */ 12005 /** gps not turned on * @illustrate Android Unique ,Not open GPS Position switch */ 12006 /** user denied * @illustrate Users refuse to authorize links Wi-Fi */ 12007 /** invalid SSID * @illustrate invalid SSID */ 12008 /** system config err * @illustrate System operator configuration refuses to connect Wi-Fi */ 12009 /** system internal error * @illustrate Other errors in the system ,Need in errmsg Print the specific error cause */ 12010 /** weapp in background * @illustrate Apply in the background cannot be configured Wi-Fi */ 12011 /** wifi config may be expired * @illustrate Preservation Wi-Fi Configuration expire ,It is recommended to forget Wi-Fi Re -test */ 12013 } /** NFC error code */ interface NFCErrCode { /** ok * @illustrate normal */ 0 /** @illustrate The current device does not support NFC */ 13000 /** @illustrate Current device support NFC,System NFC The switch is not turned on */ 13001 /** @illustrate Current device support NFC,But not support HCE */ 13002 /** @illustrate AID List parameter format error */ 13003 /** @illustrate No WeChat is set to default NFC Payment application */ 13004 /** @illustrate The instructions returned are illegal */ 13005 /** @illustrate register AID fail */ 13006 /** @illustrate unknown mistake */ 13010 /** user is not authorized * @illustrate Unauthorized user */ 13019 /** invalid parameter * @illustrate Invalid argument */ 13011 /** parse NdefMessage failed * @illustrate Perform the parameter to NdefMessage fail */ 13012 /** NFC tag has not been discovered * @illustrate No scan NFCLabel */ 13013 /** invalid tech * @illustrate Infernal label technology */ 13014 /** unavailable tech * @illustrate Get the corresponding technology failure from the label */ 13015 /** connect fail * @illustrate Connection failed */ 13016 /** system internal error * @illustrate Related reading and writing operations failed */ 13017 /** NFC discovery has not started * @illustrate Try not to start NFC Stop when scanning NFC scanning */ 13018 /** NFC discovery already started * @illustrate already started NFC scanning */ 13021 /** Tech already connected * @illustrate Tags have been connected */ 13022 /** Tech has not connected * @illustrate Try to disconnect the connection when the label is not connected */ 13023 /** function not support * @illustrate The current label technology does not support this function */ 13024 } // Events class Events { /** * Monitor an event ,Accept parameters */ on(eventName: string, listener: (...args: any[]) => void): this /** * Add an event monitoring ,And remove after the event trigger is completed Callbackschain */ once(eventName: string, listener: (...args: any[]) => void): this /** * Cancel a monitoring event */ off(eventName: string, listener?: (...args: any[]) => void): this /** * Cancel all incidents of monitoring */ off(): this /** * Trigger an event ,Parameter */ trigger(eventName: string, ...args: any[]): boolean } // ENV_TYPE enum ENV_TYPE { WEAPP = 'WEAPP', WEB = 'WEB', RN = 'RN', SWAN = 'SWAN', ALIPAY = 'ALIPAY', TT = 'TT', QQ = 'QQ', JD = 'JD' } type TDeviceRatio = Record }