kiboit / phast

Automated web page optimization for PHP
https://www.phast.io/
GNU Affero General Public License v3.0
35 stars 1 forks source link

How do you load the script from the indexeddb to actual scripts tab #16

Open khanakia opened 3 years ago

khanakia commented 3 years ago

Hello @apeschar,

First of all thanks for the great plugin. I have few questions and trying to learn how the plugin works under the hood. I see you send the XHR request and loads all the scripts in the indexed db.

But after that how do you load the scripts into SCRIPTS TAG because i do not see any JS file request sending in the Chrome developer tools.

It would be helpful if you give me some insight on this how are you loading the scripts from indexdb to actual <script> tag ?

Thanks

apeschar commented 3 years ago

This is the code for the scripts execution:

https://github.com/kiboit/phast/blob/master/src/Filters/HTML/ScriptsDeferring/scripts-loader.js#L77-L98

If you read the whole file, you'll understand how Phast executes scripts.