There is no direct way to do this. The Office JS library does not have an event for slide transitions in PowerPoint.
However, there is a hacky way to do this which involves refreshing the web app on a periodic basis and using getSelectedDataAsync with the CoercionType of SlideRange. This gives you the full range of slides in the document and from that you can get the index of the current slide. You could store that index in a setting and check if it changes if it does you have your event.
Here is the basic code (refreshes every 1.5 seconds)
//Automatically refresh
window.setInterval(function () {
//get the current slide
Office.context.document.getSelectedDataAsync(Office.CoercionType.SlideRange, function (r) {
// null check
if (!r || !r.value || !r.value.slides) {
return;
}
//get current slides index
currentSlide = r.value.slides[0].index;
//get stored setting for current slide
var storedSlideIndex = Office.context.document.settings.get("CurrentSlide");
//check if current slide and stored setting are the same
if (currentSlide != storedSlideIndex) {
//the slide changed - do something
//update the stored setting for current slide
Office.context.document.settings.set("CurrentSlide", currentSlide);
Office.context.document.settings.saveAsync(function (asyncResult) { });
}
});
}, 1500);