UNPKG

@textback/notification-widget

Version:

TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.

38 lines (34 loc) 992 B
import FacebookChannel from "./facebook.js"; import TelegramChannel from "./telegram.js"; import ViberChanel from "./viber.js"; import VKChannel from "./vk.js"; import WhatsappChannel from "./whatsapp.js"; import WhatsappbChannel from "./whatsappb.js"; import MaxChannel from "./max.js"; function getConstructor(channel) { switch (channel) { case "facebook": return FacebookChannel; case "tg": return TelegramChannel; case "viber": return ViberChanel; case "vk": return VKChannel; case "whatsapp": return WhatsappChannel; case "whatsappb": return WhatsappbChannel; case "max": return MaxChannel; default: return null; } } const channelsFactory = { create(channelObj, deeplink, widget) { const constructor = getConstructor(channelObj.channel); return constructor ? new constructor(channelObj, deeplink, widget) : null; }, }; export default channelsFactory;