Skip to content

Instantly share code, notes, and snippets.

@fisknils
Last active November 18, 2017 11:54
Show Gist options
  • Save fisknils/477fcfed0a37c99cdaf3d937a2883f43 to your computer and use it in GitHub Desktop.
Save fisknils/477fcfed0a37c99cdaf3d937a2883f43 to your computer and use it in GitHub Desktop.
// including jquery in your electron body.
//
// https://stackoverflow.com/questions/32621988/electron-jquery-is-not-defined
// https://stackoverflow.com/a/37480521/4023754
<!-- Insert this line above script imports -->
if (typeof module === 'object') {window.module = module; module = undefined;}
<!-- normal script imports etc -->
[
"https://code.jquery.com/jquery-2.2.4.min.js"
].forEach((src){
let script = document.createElement('script');
script.src = src;
document.querySelector('head').appendChild(script);
});
<!-- Insert this line after script imports -->
<script>if (window.module) module = window.module;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment