import { addBtnLoader } from './service/append';
import { onChangeTab, onLocationChange } from '@content/service/util';
import { listenerFetch } from '@content/service/event';

export function main(ctx) {
  ctx.addEventListener(document, 'readystatechange', () => {
    ctx.setTimeout(() => {
      addBtnLoader();
    }, 2000);
  });

  onChangeTab(() => {
    ctx.setTimeout(() => {
      addBtnLoader();
    }, 1000);
  });

  onLocationChange(ctx, () => {
    ctx.setTimeout(() => {
      addBtnLoader();
    }, 500);
  });

  ctx.setTimeout(() => {
    listenerFetch();
  }, 500);
}
