Currently, you need to register for manifest events using:
window.addEventListener("appinstalled", handleAppInstalled);
window.addEventListener("beforeinstallprompt", handleBeforeInstallPrompt);
According to the spec [1] you should be able to register using the attribute version:
window.onappinstalled = handleAppInstalled;
window.onbeforeinstallprompt = handleBeforeInstallPrompt;
[1] https://www.w3.org/TR/appmanifest/#extensions-to-the-window-object
Comment 1 by mgiuca@chromium.org
, May 17 2017