index.uts 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
import { ShowLoadingOptions,ShowLoading,HideLoading} from "../interface.uts"
import { ShowToastOptions,ShowToast,HideToast} from "../interface.uts"
import { ShowActionSheetOptions,ShowActionSheet} from "../interface.uts"
import { ShowModalOptions,ShowModal} from "../interface.uts"

import * as ToastModule from "./showToast.uts"
import * as ModalModule from "./showModal.uts"
import * as ActionSheetModule from "./showActionSheet.uts"

import UTSAndroid from 'io.dcloud.uts.UTSAndroid';

export const showToast : ShowToast = function (options : ShowToastOptions) {
	
	// 指定在ui线程执行
	UTSAndroid.dispatchAsync('main',function(res){
		ToastModule.showToastImpl(options)
	},null)
	
}

export const hideToast : HideToast = function () {
	UTSAndroid.dispatchAsync('main',function(res){
		ToastModule.hideToastImpl()
	},null)

}

export const showLoading : ShowLoading = function (options : ShowLoadingOptions) {
	UTSAndroid.dispatchAsync('main',function(res){
		ToastModule.showLoadingImpl(options)
	},null)
}

export const hideLoading : HideLoading = function () {
	UTSAndroid.dispatchAsync('main',function(res){
		ToastModule.hideLoadingImpl()
	},null)
}

export const showModal : ShowModal = function (options : ShowModalOptions) {
	UTSAndroid.dispatchAsync('main',function(res){
		ModalModule.showModalImpl(options)
	},null)
}

export const showActionSheet : ShowActionSheet = function (options : ShowActionSheetOptions) {
	UTSAndroid.dispatchAsync('main',function(res){
		ActionSheetModule.actionSheetImpl(options)
	},null)
}