Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Wishy allows you to dynamically import scripts, adding them as <script> tags in the DOM. Its name comes from wishy-washy, meaning indecisive.
You could and should use dynamic import() to load ES6 modules, but unfortunately not all things are written that way. Wishy allow you to import simple scripts.
Just call the wish function with a list of paths to the scripts you want to import. You can also put in an object and wishy will interpret key/vales as attributes. The <script> tags are added to a <div> with class "_wishywashy". For example:
wish([
"path1",
{
"src": "path2"
"key": "value"
}
])
is rendered in the DOM as
<div class="_wishywashy">
<script src="path1"></script>
<script src="path2" key="value"></script>
</div>
You can remove all <script> tags from the DOM with the wash() function, but that won't remove them from memory.
Just plain import the script. It'll create a function called "wish()" to which you pass your script paths and a "wash()" to remove them.
Note that any script loaded by wishy is deferred and won't be executed synchronously. Wish is written in ES6. Calling wish() inside a module script won't work.
FAQs
Simplistic dynamic script loader for non-modules.
We found that wishy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.