Skip to content

Commit

Permalink
File open operations can now be cancelled
Browse files Browse the repository at this point in the history
  • Loading branch information
verma committed Mar 6, 2014
1 parent 99893ec commit 8f427c0
Show file tree
Hide file tree
Showing 3 changed files with 237 additions and 82 deletions.
5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@
box-sizing: border-box;
}
#loaderProgress p {
color: #999;
font-size: 12px;
padding: 0px;
margin: 0px;
margin: 5px 0px 0px 0px;
}

#loaderProgress .progress {
Expand Down Expand Up @@ -348,6 +350,7 @@ <h5>Set the load density. Smaller values load and display faster.
<div id="loadFidelity"></div>
</div>
<div id="loaderProgress">
<button style="margin-left: 10px;" type="button" class="close">&times;</button>
<div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="20"
aria-valuemin="0" aria-valuemax="100" style="width: 20%;">
Expand Down
4 changes: 2 additions & 2 deletions js/laslaz.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@
scope.handleMessage = function(message_event) {
var msg = message_event.data;
var resolver = waitHandlers[msg.id];
delete waitHandlers[msg.id];

// call the callback in a separate context, make sure we've cleaned our
// state out before the callback is invoked since it may queue more doExchanges
setTimeout(function() {
if (msg.error)
return resolver.reject(new Error(msg.message || "Unknown Error"));


if (msg.hasOwnProperty('count') && msg.hasOwnProperty('hasMoreData')) {
return resolver.resolve({
buffer: msg.result,
Expand All @@ -110,7 +110,7 @@

nacl_module.postMessage(cmd);

return resolver.promise;
return resolver.promise.cancellable();
};

// LAS Loader
Expand Down
Loading

0 comments on commit 8f427c0

Please sign in to comment.