-
-
Notifications
You must be signed in to change notification settings - Fork 155
Open
Description
I believe this is due to the way jquery initializes itself when running in electron. I am able to use TouchSpin when I test in a static page directly from a browser ("file:///mytest.html"), but when I run in my Electron based application, it seems that touchspin has not properly initialized itself -- the console shows:
Uncaught TypeError: $(...).TouchSpin is not a function
I am able to use jquery in my other js files by using the onload technique mentioned in a comment in this post: https://techsparx.com/nodejs/electron/load-jquery-bootstrap.html
My header:
<link rel="stylesheet" href="static/css/bootstrap.min-darkly.css">
<link rel="stylesheet" href="static/css/jquery.bootstrap-touchspin.css"/>
<link rel="stylesheet" href="static/css/base.css">
<!-- jQuery/Electron "bug": https://techsparx.com/nodejs/electron/load-jquery-bootstrap.html -->
<script src="static/js/jquery-3.4.1.min.js" type="text/javascript"
onload="window.$ = window.jQuery = module.exports;"></script>
<script src="static/js/popper.min.js"></script>
<script src="static/js/bootstrap.min.js"></script>
<script src="static/js/jquery.bootstrap-touchspin.js"></script>
and I'm calling TouchSpin from one my scripts like this:
$('.ts').TouchSpin({
min: 0, max: 10
});
I am not enough of a javascript programmer to debug how the closure works in touchspin's js.
Ideas for how I can get touchspin to initialize itself under electron?
Metadata
Metadata
Assignees
Labels
No labels