cronPush function

void cronPush(
  1. String jadwal,
  2. CronHandleTypedef fungsi, [
  3. bool sekali = false
])

origin: kt_ifm_gtid_mob/lib/cron.dart author: anovsiradj, opencode-go/glm-5.2 version: 2025-03-04, revised: 2026-08-17

Register fungsi under jadwal cron pattern. If sekali = true, runs once then auto-removes.

Implementation

void cronPush(String jadwal, CronHandleTypedef fungsi, [bool sekali = false]) {
  cronInit(jadwal);

  if (cronBekerjas.contains(fungsi)) return;

  cronAntrians[jadwal] ??= [];
  if (cronAntrians[jadwal]!.contains(fungsi)) return;
  cronAntrians[jadwal]!.add(fungsi);

  if (sekali) cronSekalis.add(fungsi);
}