inline-script
v1.0.3
Published
inline-script is so small library let's use write your javascript code inline with script="" attribute. It's has no opinion to how to utilize your code with whatever dom manipulation tool (jquery, cash etc.)
Downloads
5
Readme
inline-script
inline-script is so small library let's use write your javascript code inline with script="" attribute. It's has no opinion to how to utilize your code with whatever dom manipulation tool (jquery, cash etc.)
inline-script is second stepping to complete hypermedia api's to have "islands of interacivity". We could also call this hypermedia friendly scripting.
There are already solutions to this "hyperscript" by htmx, "surreal" by gnat and also "Alpine.js" by calebporzio. They are great. They all have their unique styles to do dom manipulations.
inline-script is just like onclick, obdblclick events. it is just script attribute with this represents the element itself like this to onclick. So you can wrap $(this) with jquery, jquery-like or whatever library and use it for all your needs.
Usage
<script src="https://www.unpkg.com/inline-script"></script>
inline-script can be used by cdn or by downloading.
<h1 script="getWeatherOf([39.9, 32.8]).then(data => this.textContent =data.current_weather.temperature + '°C')"></h1>
Glossary
WIP
Size
| Size | inline-script | | ------------------ | ----------- | | Unminified | 1.4 KB | | Minified | 470 B | | Minified & Gzipped | 330 B |