jobManager
constjobManager:object
Defined in: packages/expo-arcgis-toolkit/src/jobManager.ts:45
The Swift Toolkit’s shared job manager, for expo-arcgis’s long jobs (offline.generateOfflineMap
and the other JobRefs).
- It keeps the jobs added to it across app launches.
- It gives them background time when the app moves to the background.
- It can check their status in the background on a schedule.
After a relaunch, jobs() hands back the jobs it kept: call result() on each to follow it to
its end.
It needs the expo-arcgis-toolkit config plugin with "jobManager": true, which permits its
background task in Info.plist. Without that, its functions throw.
const job = await offline.generateOfflineMap(map, area, 'my-area');await jobManager.add(job);const { path } = await job.result();await jobManager.remove(job);Type Declaration
Section titled “Type Declaration”add(
job):Promise<void>
Manages the job: it is kept across launches until it is removed. Saves the jobs.
Parameters
Section titled “Parameters”JobRef<unknown>
Returns
Section titled “Returns”Promise<void>
jobs()
Section titled “jobs()”jobs():
Promise<JobRef<unknown>[]>
The jobs it manages, those it kept across launches included.
Returns
Section titled “Returns”Promise<JobRef<unknown>[]>
remove()
Section titled “remove()”remove(
job):Promise<void>
Stops managing the job, typically once it has finished. Saves the jobs.
Parameters
Section titled “Parameters”JobRef<unknown>
Returns
Section titled “Returns”Promise<void>
resumeAllPausedJobs()
Section titled “resumeAllPausedJobs()”resumeAllPausedJobs():
Promise<void>
Resumes the jobs that paused (when the app was suspended or terminated).
Returns
Section titled “Returns”Promise<void>
saveState()
Section titled “saveState()”saveState():
Promise<void>
Saves the jobs now. It also saves them when the app moves to the background or ends.
Returns
Section titled “Returns”Promise<void>
setBackgroundStatusCheckInterval()
Section titled “setBackgroundStatusCheckInterval()”setBackgroundStatusCheckInterval(
seconds):Promise<void>
Checks the jobs’ status in the background every seconds (the Toolkit’s
preferredBackgroundStatusCheckSchedule); null stops it. iOS decides when it actually runs.
Parameters
Section titled “Parameters”seconds
Section titled “seconds”number | null
Returns
Section titled “Returns”Promise<void>
Default
Section titled “Default”nullPlatform
Section titled “Platform”ios — the Kotlin Toolkit has no job manager; on Android its functions do nothing.