Delay dependency load
paulirish opened this issue · comments
So I think I reported a bug for EmulatedDeviceLab to another project. :)
The difference appears to be
- devtools_page will immediately load all those assets anytime devtools is opened
- ( panels.create() will occur once a user navigates to the tab. )
can we only load traceur into the devtools once we need it?
From what I can see, it looks like the browserAction (the button)'s behaviour all takes place through background.js, but Traceur is also being loaded in by devtools.html every time DevTools loads. That said, I can't see any behaviour that actually relies on DevTools (though, admittedly I haven't looked too hard 😜). Is devtools.html needed at all?
Sorry for a late response, I've been offline lately.
Paul is right, some EDL scripts are, indeed, loaded with every DevTools instance*. I can, and will, reduce them to the minimum, but I believe that traceur.js
is the biggest bottleneck here. What I could do is write a small ES5 script (that does not require traceur) to do all the checking and, only if EDL is really needed, load traceur and rest of the ES6 scripts. I would like to avoid that though - mixing ES5 and ES6 sounds like a really bad idea. What we can do instead, is to provide a production version of EDL. Currently, we are all running a dev version (ES6 is transpiled on the fly). I'll add a build script that transpiles, bundles and minifies all the scripts (#48). However, this repo is not a great place to keep the production version of EDL. That's why I was thinking about distributing it via CWS. Paul, what do you think about that? Can we have an official ChromeDevTools CWS account?
(*) @richgilbank devtools.html
is needed to provide the style-syncing capability. See devtools.js for details.