How can I check if a JS file has been included already?

前端 未结 5 2055
日久生厌
日久生厌 2020-12-15 18:24

I have split my javascript in different files. I want to prevent, that javascript files are loaded twice. How can I do that?

5条回答
  •  星月不相逢
    2020-12-15 19:07

    You would need to manually track this and make sure. UweB's suggestion would also work.

    You could also check out Require.js which could help you to organize your files.

提交回复
热议问题