My feeling is that most extensions will not need an extensive setup routine, and even when they do, it'll usually be done at page load. So my suggestion is that the admin boilerplate JS be simplified to just
(function () {
"use strict";
jQuery( function ($) {
if ($('body.post-type-popup form#post').size() === 0) return;
// do whatever
});
}());
My feeling is that most extensions will not need an extensive setup routine, and even when they do, it'll usually be done at page load. So my suggestion is that the admin boilerplate JS be simplified to just