如何以编程方式退出或关闭Javascript UWP应用程序? (Windows 10) [英] How to exit or close an Javascript UWP app programmatically? (Windows 10)

查看:158
本文介绍了如何以编程方式退出或关闭Javascript UWP应用程序? (Windows 10)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个游戏,它需要它自己的退出按钮.

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

我无法使用 CoreApplication 类在 Windows.ApplicationModel.Core 命名空间中在Javascript应用程序中.

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.

推荐答案

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

    window.close();


重要说明(来自MSDN):如果您使用window.close,则它对用户显示为崩溃,并记录为Windows Store仪表板上开发人员的遥测数据中的崩溃.


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.

这篇关于如何以编程方式退出或关闭Javascript UWP应用程序? (Windows 10)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆