Skip to content

Commit

Permalink
Silverlight: Added Destroy event handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
jayarjo committed Jan 25, 2011
1 parent 4a3f2ef commit 98d1d2c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/javascript/plupload.flash.js
Expand Up @@ -9,7 +9,7 @@
*/

// JSLint defined globals
/*global plupload:false, ActiveXObject:false, escape:false */
/*global window:false, document:false, plupload:false, ActiveXObject:false, escape:false */

(function(window, document, plupload, undef) {
var uploadInstances = {}, initialized = {};
Expand Down
22 changes: 18 additions & 4 deletions src/javascript/plupload.silverlight.js
Expand Up @@ -9,13 +9,13 @@
*/

// JSLint defined globals
/*global plupload:false, ActiveXObject:false, window:false */
/*global window:false, document:false, plupload:false, ActiveXObject:false, window:false */

(function(plupload) {
(function(window, document, plupload, undef) {
var uploadInstances = {}, initialized = {};

function jsonSerialize(obj) {
var value, type = typeof obj, undef, isArray, i, key;
var value, type = typeof obj, isArray, i, key;

// Encode strings
if (type === 'string') {
Expand Down Expand Up @@ -413,9 +413,23 @@
plupload.removeClass(browseButton, activeClass);
}
});

uploader.bind("Destroy", function(up) {
var silverlightContainer;

plupload.removeAllEvents(document.body, up.id);

delete initialized[up.id];
delete uploadInstances[up.id];

silverlightContainer = document.getElementById(up.id + '_silverlight_container');
if (silverlightContainer) {
container.removeChild(silverlightContainer);
}
});

callback({success : true});
});
}
});
})(plupload);
})(window, document, plupload);

0 comments on commit 98d1d2c

Please sign in to comment.