-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
28 lines (26 loc) · 848 Bytes
/
index.js
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
import {attachEvents, initIntlPhone} from "./src/scripts/init.mjs";
import {
loadContactCardWidget, showContactCardDefault, showContactCardHorizontal, showContactCardVertical
} from "./src/scripts/contactCard.mjs";
import {profileDataSachin} from "./src/test/sample-profile.js";
const promiseClosure = (e) => {
if (!e) {
return;
}
console.log("promise", e);
};
const main = async () => {
const loadWidgetPromise = loadContactCardWidget();
loadWidgetPromise.finally(() => {
console.log("widget has been loaded");
initIntlPhone();
showContactCardDefault(profileDataSachin);
showContactCardHorizontal(profileDataSachin);
showContactCardVertical(profileDataSachin);
attachEvents();
});
};
//invoke immediately
(function () {
main().then(promiseClosure).catch(promiseClosure).finally(promiseClosure);
})();