May I suggest a small improvement, so that in the callback, we can interact with the window?
In setActionCallback, just add the 'self' parameter to the callback.
Was:
var cb = function() { self.hide();callback();};
Suggested:
var cb = function() { self.hide();callback(self);};