No, the code running inside the panel does not have the necessary privileges to call any SDK modules. This is solved using the contents of the script, which will send the message back to the extension. Then the extension can resize the panel. Something along these lines (unchecked):
var panel = require("panel").Panel({
contentURL: ...,
contentScript: "self.port.emit('resize', " +
"{width: document.documentElement.clientWidth, " +
"height: document.documentElement.clientHeight});"
});
panel.port.on("resize", function({width, height})
{
panel.resize(width, height);
});
panel.show();
source
share