How to exit or close an Javascript UWP app programmatically? (Windows 10)

Deadly 提交于 2020-01-05 04:04:51

问题


I made a game and it needs it own exit button.

I was not able to use the CoreApplication.Exit() static method here. There is no CoreApplication class in Windows.ApplicationModel.Core namespace in Javascript Applications.


回答1:


CoreApplication.Exit is provided only for testing purposes. If you want to exit app you can close current window

    window.close();

Important note (from MSDN): If you use window.close, it appears as a crash to the user and is logged as a crash in the developer’s telemetry data on the Windows Store dashboard.

If you want to proactively "crash" app - you should use the terminateApp method.



来源:https://stackoverflow.com/questions/37848841/how-to-exit-or-close-an-javascript-uwp-app-programmatically-windows-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!