So here is an implementation of the onunload event:
Widget.prototype.destroy = function(w) {
var w = w || this;
if(w._customRegistry['onunload'])
w._customRegistry['onunload'](w);
QuiX.removeWidget(w);
}
And
Widget.prototype.customEvents = ['onload','onresize','ondrop','onunload'];