Javascript 我们如何从按钮点击打开PWA弹出窗口

Javascript 我们如何从按钮点击打开PWA弹出窗口,javascript,jquery,reactjs,react-native,Javascript,Jquery,Reactjs,React Native,如何在按钮点击事件中打开PWA弹出窗口。 我试过下面的代码,但没有成功 // Stop Chrome from asking _now_ ev.preventDefault(); // Create your custom "add to home screen" button here if needed. // Keep in mind that this event may be called multiple times, // so avoi

如何在按钮点击事件中打开PWA弹出窗口。 我试过下面的代码,但没有成功

  // Stop Chrome from asking _now_
  ev.preventDefault();

  // Create your custom "add to home screen" button here if needed.
  // Keep in mind that this event may be called multiple times, 
  // so avoid creating multiple buttons!
  myCustomButton.onclick = () => ev.prompt();
});