Last active
April 25, 2021 17:32
-
-
Save kikocorreoso/3ac16c87777a91461900d19543b7c612 to your computer and use it in GitHub Desktop.
load js on demand on brython.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.9.2/brython.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.9.2/brython_stdlib.min.js"></script> | |
</head> | |
<body onload="brython()"> | |
<script type="text/python"> | |
from browser import document, window, html | |
def load(ev): | |
script = html.SCRIPT( | |
src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js", | |
) | |
document <= script | |
script.onload = _onload | |
def _onload(ev): | |
document['text_info'].text = window.L.version | |
document['btn'].bind('click', load) | |
</script> | |
<button id="btn">Load leaflet</button> | |
<div id="text_info"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment