// This JS lives within maintenanceBackgroundTask.js
var processPic = new processPictures()
var count = 0
var retval = false
function onCanceled(cancelSender, cancelReason) {
// Device is now on DC power, cancel processing of files
processPic.cancel = true
}
backgroundTaskInstance.addEventListener("canceled", onCanceled)
var list = []
processPic.enumerateFiles(list).then(function (value) {
count = value
processPic.processFiles(list).then(function (value) {
retval = value
// Call close() to indicate the task is complete when
// all async methods have completed
close()
})
})
</pre>