Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cancel a background task in windows 8.1 using javascript

I am building a windows 8 metro app using javascript and html5. I want to know following things.

  1. How can I cancel the current instance of any running background task.
  2. What are the possible conditions when system automatically cancels background task.
like image 221
Rusi Nova Avatar asked Oct 19 '13 16:10

Rusi Nova


1 Answers

JavaScript background tasks are executed in web workers, so just use close() within running background task to end it when ever you want. If you want to do this from your app code, check out following MSDN sample: http://msdn.microsoft.com/en-us/library/windows/apps/jj160500.aspx.

There are many conditions when system may cancel your task, but that depends how you registered it (is it lock screen task etc). In normal conditions each background tasks has 1s CPU quota and 7.5 MB daily data quota. You can read more about it here: http://msdn.microsoft.com/en-us/library/windows/apps/hh977046.aspx

like image 157
Tadeusz Wójcik Avatar answered Sep 29 '22 07:09

Tadeusz Wójcik