Last active
July 18, 2023 17:40
-
-
Save dbismut/2ddf2de912e5d0cd02a16b2eff6c9263 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OPTION 1 | |
// Close Icon managed by CTO, alert managed by CTO | |
TryOn.init({ | |
events: { | |
close: () => { | |
window.modal.close(); // closes the popin embedding the CTO experience | |
} | |
} | |
}); | |
// OPTION 2 | |
// Close Icon managed by Parent, alert managed by CTO | |
TryOn.init({ | |
events: { | |
status: (status) => { | |
switch(status) { | |
case "ar": | |
// icon.<method> are all pseudo functions to be implemented on the parent page side | |
icon.setFill('#fff'); | |
icon.setShadow(true); | |
icon.show(); | |
break; | |
case "search": | |
case "home": | |
icon.setFill('#000'); | |
icon.setShadow(false); | |
break; | |
case "product": | |
icon.hide(); | |
break; | |
} | |
} | |
} | |
}); | |
const originalModalClose = window.modal.close | |
window.modal.close = () => { | |
try { | |
await TryOn.requestClose(); | |
originalModalClose(); | |
} | |
catch {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment