UNPKG

coolink-ts

Version:

Coocaa Coolink APP JavaScript library base on Thresh-lib.

31 lines (25 loc) 713 B
import MethodChannel, { FlutterMethodChannelType } from "../channel/MethodChannel"; import Util from '../shared/Util' import bus from '../shared/bus' /** * File管理器 */ export default class FileManager { static pickFiles(callback: Function): void { const methodId: string = 'pickFiles'; if (Util.isFunc(callback)) { bus.register(callback, methodId) } MethodChannel.call({ method: FlutterMethodChannelType.fileRequest, params: { methodId: 'pickFiles' }, }) } static response(methodId: string, response: any) { if (!bus.has(methodId)) return bus.fire(methodId, response) bus.remove(methodId) } }