

简体中文
用法:registerUniModule(string moduleName, Object module)
示例代码
import { registerModule } from '@dcloudio/uni-app-runtime'
interface IEchoObject {
message: string
}
class Echo {
echoSync(str: string) {
return 'response: ' + str
}
echoAsync(str:string, callback: Function) {
setTimeout(() => {
callback('response: ' + str)
}, 1000)
}
echoObjSync(str: string) {
return { message: 'response: ' + str } as IEchoObject
}
echoObjAsync(str:string, callback: Function) {
setTimeout(() => {
callback({ message: 'response: ' + str } as IEchoObject)
}, 1000)
}
}
registerModule('echo', new Echo())