动态导入打字稿中的多个功能
dynamic Import for multiple functions in typescript
我的代码中有如下静态导入
import { findBotletByTelephonyNumber, fetchClientCustomSettings, fetchCallerStatus } from './../shared/custom-settings.service';
发展如下
export const findBotletByTelephonyNumber = (x) => { //return something }
我正在另一个函数中使用它们。
现在我想切换到 dynamic import
(Typescript),网上的所有示例都是导入单个模块。
我的问题是如何通过动态导入导入多个函数(一个一个地导入或全部导入)?
我弄明白了,以防其他人遇到同样的问题
const customSettingsModule = await import('./../shared/custom-settings.service');
customSettingsModule.findBotletByTelephonyNumber(6);
我的代码中有如下静态导入
import { findBotletByTelephonyNumber, fetchClientCustomSettings, fetchCallerStatus } from './../shared/custom-settings.service';
发展如下
export const findBotletByTelephonyNumber = (x) => { //return something }
我正在另一个函数中使用它们。
现在我想切换到 dynamic import
(Typescript),网上的所有示例都是导入单个模块。
我的问题是如何通过动态导入导入多个函数(一个一个地导入或全部导入)?
我弄明白了,以防其他人遇到同样的问题
const customSettingsModule = await import('./../shared/custom-settings.service');
customSettingsModule.findBotletByTelephonyNumber(6);