The JavaScript Example module shows how to load a JavaScript file before another one, by setting the weight property for each file.
That is a bad example, as the comments say, but it is also not necessary: Drupal core includes the loadjs library, which exactly for running JavaScript code once a file has been loaded from the browser. It is only used by Drupal.ajax, but the code used from Drupal core can be used as example to write our code.
As to show how to use a property for assets files part of a library, it would be sufficient to use attributes and id.
Issue fork examples-3461179
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
avpadernoComment #5
avpadernoComment #7
avpaderno