Source: utilities/on/on.js

/**
 * Copyright IBM Corp. 2018, 2023
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

/**
 *
 * @param {*} element
 * @param  {...any} args
 * @returns {Event} The event
 */

function on(element, ...args) {
  element.addEventListener(...args);
  return {
    release() {
      element.removeEventListener(...args);
      return null;
    },
  };
}

export default on;