📝 API 文档
mincu-vanilla

mincu-vanilla

Interfaces

Type Aliases

ColorSchemeName

Ƭ ColorSchemeName: "light" | "dark" | null | undefined


States

Ƭ States: Object

Type declaration

NameType
colorSchemeColorSchemeName
colorsany

Variables

dataModule

Const dataModule: DataModule


eventModule

Const eventModule: EventModule


mincu

Const mincu: Mincu


mincuCore

Const mincuCore: MincuCoreBase


networkModule

Const networkModule: NetWorkModule


uiModule

Const uiModule: UIModule

Interfaces

Interface: AppData

Properties

user

user: Object

Type declaration
NameType
colorSchemeColorSchemeName
colorsany
insetEdgeInsets
profile{ basicProfile: { app_avatar_url: string ; department: string ; department_id: string ; head_pic_url: string ; max_role_level: number ; message: string ; name: string ; status: number } ; entireProfile: IEntireProfileResponse }
profile.basicProfile{ app_avatar_url: string ; department: string ; department_id: string ; head_pic_url: string ; max_role_level: number ; message: string ; name: string ; status: number }
profile.basicProfile.app_avatar_urlstring
profile.basicProfile.departmentstring
profile.basicProfile.department_idstring
profile.basicProfile.head_pic_urlstring
profile.basicProfile.max_role_levelnumber
profile.basicProfile.messagestring
profile.basicProfile.namestring
profile.basicProfile.statusnumber
profile.entireProfileIEntireProfileResponse
tokenstring

Interface: EdgeInsets

Properties

bottom

bottom: number


left

left: number


right

right: number


top

top: number

Interface: INativeFuncs

Properties

Auth

Auth: Object

Type declaration
NameType
login(data: { password: string ; username: string }) => number
refreshToken() => { token: string }

Clipboard

Clipboard: Clipboard


DeviceInfo

DeviceInfo: DeviceInfo


Linking

Linking: RNLinking


NetInfo

NetInfo: NetInfo


Orientation

Orientation: typeof Orientation

Since

iNCU 5.9.7+


Portal

Portal: Object

Type declaration
NameType
remove(id: number) => void

Share

Share: Object

Type declaration
NameType
openShareMenu() => void
setShareConfig(config: ShareConfig) => void

StatusBar

StatusBar: Object

Type declaration
NameType
setBarStyle(style: StatusBarStyle, animated?: boolean) => void

Storage

Storage: Object

Type declaration
NameType
getItem(key: string) => any
remove(key: string) => void
reset() => void
setItem(key: string, value: any) => void

Toast

Toast: Object

Index signature

▪ [key: string]: (title: string, during: number) => number


ToastAndroid

ToastAndroid: ToastAndroidStatic


Vibration

Vibration: VibrationStatic


Webview

Webview: Object

Type declaration
NameType
bindBackPress(value: boolean) => void
disableAutoSetTitle() => void
exitWebView() => void
handleShowHeader(value?: boolean) => boolean
toScreen(e: NavConfig) => void

Interface: Mincu

Hierarchy

  • MincuCoreBase

  • DataModule

  • EventModule

  • NetWorkModule

  • UIModule

    Mincu

Properties

axiosInterceptors

axiosInterceptors: () => { error: (error: any) => Promise<any> ; request: (config: AxiosRequestConfig<any>) => AxiosRequestConfig<any> ; response: (response: AxiosResponse<any, any>) => AxiosResponse<any, any> }

Type declaration

▸ (): Object

Returns

Object

NameType
error(error: any) => Promise<any>
request(config: AxiosRequestConfig<any>) => AxiosRequestConfig<any>
response(response: AxiosResponse<any, any>) => AxiosResponse<any, any>
Inherited from

NetWorkModule.axiosInterceptors


backPress

backPress: Object

Type declaration
NameType
bind(cb: () => void, onResulst?: (success: boolean) => void) => () => void
unbind(cb: () => void) => void
Inherited from

UIModule.backPress


call

call: <Class, Method>(baseClass: Class, method: Method, params: ParamType<INativeFuncs[Class][Method]>, success?: (res?: { data: CallReturnType<INativeFuncs[Class][Method]> }) => any, failed?: (...args: any[]) => void) => void

Type declaration

▸ <Class, Method>(baseClass, method, params, success?, failed?): void

主动请求并触发客户端事件

Type parameters
NameType
Classextends keyof INativeFuncs
Methodextends string | number | symbol
Parameters
NameType
baseClassClass
methodMethod
paramsParamType<INativeFuncs[Class][Method]>
success?(res?: { data: CallReturnType<INativeFuncs[Class][Method]> }) => any
failed?(...args: any[]) => void
Returns

void

Inherited from

MincuCoreBase.call


callPromise

callPromise: <Class, Method>(baseClass: Class, method: Method, params: ParamType<INativeFuncs[Class][Method]>) => Promise<CallReturnType<INativeFuncs[Class][Method]>>

Type declaration

▸ <Class, Method>(baseClass, method, params): Promise<CallReturnType<INativeFuncs[Class][Method]>>

Type parameters
NameType
Classextends keyof INativeFuncs
Methodextends string | number | symbol
Parameters
NameType
baseClassClass
methodMethod
paramsParamType<INativeFuncs[Class][Method]>
Returns

Promise<CallReturnType<INativeFuncs[Class][Method]>>

Inherited from

MincuCoreBase.callPromise


fetch

fetch: any

Deprecated

networkModule.useAxiosInterceptors is for your need

Inherited from

NetWorkModule.fetch


initial

initial: (resolve: (value?: unknown) => any, reject?: (value?: unknown) => any) => void

Type declaration

▸ (resolve, reject?): void

Parameters
NameType
resolve(value?: unknown) => any
reject?(value?: unknown) => any
Returns

void

Inherited from

MincuCoreBase.initial


listener

listener: (eventName: string, fn: (data: any) => any) => EventEmitter

Type declaration

▸ (eventName, fn): EventEmitter

添加一个原生事件监听器

Parameters
NameType
eventNamestring
fn(data: any) => any
Returns

EventEmitter

Inherited from

MincuCoreBase.listener


makeProxyFromNativeFunc

makeProxyFromNativeFunc: <Class>(func: Class) => INativeFuncs[Class]

Type declaration

▸ <Class>(func): INativeFuncs[Class]

Return a proxy handle callPromise from INativeFuncs

Type parameters
NameType
Classextends keyof INativeFuncs
Parameters
NameType
funcClass
Returns

INativeFuncs[Class]

Inherited from

MincuCoreBase.makeProxyFromNativeFunc


once

once: (eventName: string, fn: (data: any) => any) => EventEmitter

Type declaration

▸ (eventName, fn): EventEmitter

添加一个原生事件监听器 (监听一次后立即销毁)

Parameters
NameType
eventNamestring
fn(data: any) => any
Returns

EventEmitter

Inherited from

MincuCoreBase.once


orientation

orientation: typeof Orientation

Since

iNCU 5.9.7+

Inherited from

UIModule.orientation


remove

remove: (eventName: string, fn: (data: any) => any) => void

Type declaration

▸ (eventName, fn): void

移除某个原生事件监听器

Parameters
NameType
eventNamestring
fn(data: any) => any
Returns

void

Inherited from

MincuCoreBase.remove


storage

storage: MincuStorage

Inherited from

DataModule.storage


toast

toast: Object

Type declaration
NameType
fail(title: string, during?: number) => Promise<number>
info(title: string, during?: number) => Promise<number>
loading(title: string, during?: number) => Promise<() => void>
remove(key: number) => Promise<void>
success(title: string, during?: number) => Promise<number>
Inherited from

UIModule.toast


token

token: string

Inherited from

NetWorkModule.token

Accessors

appData

get appData(): AppData

由 iNCU WebView 注入的来自 App 的数据

Returns

AppData

Inherited from

MincuCoreBase.appData


colorScheme

get colorScheme(): ColorSchemeName

Returns

ColorSchemeName

Inherited from

DataModule.colorScheme


colors

get colors(): any

Returns

any

Inherited from

DataModule.colors


inset

get inset(): EdgeInsets

Returns

EdgeInsets

Inherited from

DataModule.inset


isApp

get isApp(): boolean

通过 userAgent 判断是否在 iNCU 环境 userAgent: iNCU.*

Returns

boolean

Inherited from

MincuCoreBase.isApp


isDark

get isDark(): boolean

Returns

boolean

Inherited from

DataModule.isDark


isReady

get isReady(): any

由 App 端注入的数据段,用以判断是否注入成功

Returns

any

Inherited from

MincuCoreBase.isReady


messageChannel

get messageChannel(): EventEmitter

与 App 端通信的消息通道

Returns

EventEmitter

Inherited from

MincuCoreBase.messageChannel


userInfo

get userInfo(): Object

Returns

Object

NameType
colorSchemeColorSchemeName
colorsany
insetEdgeInsets
profile{ basicProfile: { app_avatar_url: string ; department: string ; department_id: string ; head_pic_url: string ; max_role_level: number ; message: string ; name: string ; status: number } ; entireProfile: IEntireProfileResponse }
profile.basicProfile{ app_avatar_url: string ; department: string ; department_id: string ; head_pic_url: string ; max_role_level: number ; message: string ; name: string ; status: number }
profile.basicProfile.app_avatar_urlstring
profile.basicProfile.departmentstring
profile.basicProfile.department_idstring
profile.basicProfile.head_pic_urlstring
profile.basicProfile.max_role_levelnumber
profile.basicProfile.messagestring
profile.basicProfile.namestring
profile.basicProfile.statusnumber
profile.entireProfileIEntireProfileResponse
tokenstring
Inherited from

DataModule.userInfo


webview

get webview(): any

App 端的 Webview JavaScriptInterface,用以向 App 端发送信息

Returns

any

Inherited from

MincuCoreBase.webview

Methods

exit

exit(): void

Returns

void

Inherited from

UIModule.exit


getStoredToken

getStoredToken(): void

Deprecated

should not use

Returns

void

Inherited from

NetWorkModule.getStoredToken


getVersion

getVersion(): Promise<string>

Returns

Promise<string>

Inherited from

DataModule.getVersion


handleShowHeader

handleShowHeader(value): Promise<boolean>

Parameters
NameType
valueboolean
Returns

Promise<boolean>

Inherited from

UIModule.handleShowHeader


login

login(username, password): void

Parameters
NameType
usernamestring
passwordstring
Returns

void

Inherited from

EventModule.login


openUrl

openUrl(url): void

通过系统默认浏览器打开 Web 页面

主要适配一些端内转端外场景和 deeplink

Parameters
NameTypeDescription
urlstring要跳转的链接
Returns

void

Inherited from

EventModule.openUrl


refreshToken

refreshToken(): Promise<string>

刷新 token 函数

Returns

Promise<string>

返回一个新 token 的 Promise 对象

Inherited from

NetWorkModule.refreshToken


setBarStyle

setBarStyle(style): void

Parameters
NameType
styleStatusBarStyle
Returns

void

Inherited from

UIModule.setBarStyle


setShareConfig

setShareConfig(config): void

Parameters
NameType
configShareConfig
Returns

void

Inherited from

EventModule.setShareConfig


showShare

showShare(): void

Returns

void

Inherited from

EventModule.showShare


toScreen

toScreen(config): void

Parameters
NameType
configNavConfig
Returns

void

Inherited from

UIModule.toScreen


useAxiosInterceptors

useAxiosInterceptors(axiosInstance): void

Exmaple

const fetcher = axios.create() networkModule.useAxiosInterceptors(fetcher)

Parameters
NameType
axiosInstanceAxiosInstance
Returns

void

Inherited from

NetWorkModule.useAxiosInterceptors

Interface: NavConfig

Properties

params

Optional params: object


screen

screen: string

Interface: ShareConfig

Properties

imageUrl

Optional imageUrl: string


title

Optional title: string


url

Optional url: string