function setIntervalMethod(fn, delay) {

  let tid = null;

  const fn2 = () => {

    fn();

    tid = setTimeout(fn2, delay);

  }

  setTimeout(fn2, delay);

  return {

    clear: () => {

      clearTimeout(tid);

    }

  }

}