imobile_for_reactnative
Version:
iMobile for ReactNative,是SuperMap iMobile推出的一款基于React-Native框架的移动应用开发工具。基于该开发工具,用户可以使用JavaScript开发语言,开发出在Android和IOS操作系统下运行的原生移动GIS应用,入门门槛低,一次开发,处处运行。
37 lines (30 loc) • 932 B
text/typescript
import {
NativeModules,
NativeEventEmitter,
EmitterSubscription,
} from "react-native"
const SException = NativeModules.SException
const event = new NativeEventEmitter(SException)
interface NativeException {
message: string
callStacks: string[]
}
let subscription: EmitterSubscription | null = null
export function addNativeExceptionListener(listener: (e: NativeException) => void) {
if(subscription) {
subscription.remove()
}
subscription = event.addListener('com.supermap.rn.sexception', listener)
}
interface ARSurveyLicenseError {
feature: number
current: number
max: number
}
let licenseSubscription: EmitterSubscription | null = null
export function addARSurveyLicenseListener(listener: (error: ARSurveyLicenseError) => void) {
if(licenseSubscription) {
licenseSubscription.remove()
}
licenseSubscription = event.addListener('com.supermap.rn.sexception_arsurvey_license', listener)
}