wouldn't this code attach the listeners to the buttons each time show() is called?
function show(caption) {
var ok = WinJS.Utilities.query('button#ok', element)[0],
cancel = WinJS.Utilities.query('button#cancel', element)[0];
return new WinJS.Promise(function (complete, error, progress) {
ok.addEventListener('click', function () { complete(true); });
cancel.addEventListener('click', function () { complete(false); });
});
}
Shouldn't the listeners be removed after the promise is gone?