AbortController.signal
With AbortSignal we can more effeciently cancel multiple task using single signalCode
With AbortSignal we can more effeciently cancel multiple task using single signal

# Code
```javascript []

/**
 * @param {Function} callback
 * @param {number} delay
 * @param {AbortController.signal} signal
 * @return {Function}
 */
let setWithAbort = (callback, delay, signal) => {
  let timeoutId = setInterval(() => {
    if (!signal.aborted) {
      callback();
    }
  }, delay);

  if (signal.aborted) 
    clearInterval(timeoutId)

  signal.addEventListener(
    "abort",
    () => clearInterval(timeoutId),
    { once: true }
  );
}
/**
 * @param {Function} fn
 * @param {Array} args
 * @param {number} t
 * @return {Function}
 */
let cancellable = (fn, args, t) => {
    const controller = new AbortController()
    const signal = controller.signal;
    fn(...args);
    setWithAbort(() => fn(...args), t, signal)
    return () => controller.abort()
};

/**
 *  const result = [];
 *
 *  const fn = (x) => x * 2;
 *  const args = [4], t = 35, cancelTimeMs = 190;
 *
 *  const start = performance.now();
 *
 *  const log = (...argsArr) => {
 *      const diff = Math.floor(performance.now() - start);
 *      result.push({"time": diff, "returned": fn(...argsArr)});
 *  }
 *       
 *  const cancel = cancellable(log, args, t);
 *
 *  setTimeout(cancel, cancelTimeMs);
 *   
 *  setTimeout(() => {
 *      console.log(result); // [
 *                           //     {"time":0,"returned":8},
 *                           //     {"time":35,"returned":8},
 *                           //     {"time":70,"returned":8},
 *                           //     {"time":105,"returned":8},
 *                           //     {"time":140,"returned":8},
 *                           //     {"time":175,"returned":8}
 *                           // ]
 *  }, cancelTimeMs + t + 15)    
 */
```
['JavaScript']