Javascript Starter
Drupal
          ((Drupal, once) => {
  Drupal.behaviors.myBehavior = {
    attach(context) {
      let target = once('myBehavior', 'body');
      target.forEach((t) => {
        alert('Behavior attached');
      });
    },
  };
})(Drupal, once);
Example .libraries.yml
my-library:
  js:
    js/myLibrary.js: {}
  dependencies:
    - core/drupal
    - core/once