How can i reload custom javascript

how can i reload custom javascript in an addon/plugin so that the javascript remains part of the plugin folder?

what must the folder structure look like?

how must the instruction look like?

for the assets from the main project i did it like this so far

admin.php

<?php
$app->on('admin.init', function () {
...
// dashboard widgets
    $this->on("admin.dashboard.widgets", function ($widgets) {
      ...
      $this->helper('admin')->addAssets('assets:lib/uikit/js/components/xy_some.js');
      ...
    }
}

the folder hierarchy looks like this, or the target folder should be like this:
/addons/WidgetName/views/js

I’m not sure, what you mean with “reload”, but if you’re just searching for the path structure, you should be able to use:

$this->helper('admin')->addAssets('widgetname:views/js/my-file.js');

All addons/modules get their own path shortcut automatically.

See also: