2018-08-04 15:40:25 +02:00
|
|
|
/*
|
|
|
|
We want his module to load pretty early in the process
|
|
|
|
of starting the app, so that people.js can load early.
|
|
|
|
All the heavy lifting for reload logic happens in
|
|
|
|
reload.js, which has lots of UI dependencies. If we
|
|
|
|
didn't split out this module, our whole dependency tree
|
|
|
|
would be kind of upside down.
|
|
|
|
*/
|
|
|
|
|
2019-11-02 00:06:25 +01:00
|
|
|
let reload_in_progress = false;
|
|
|
|
let reload_pending = false;
|
2021-03-10 02:39:50 +01:00
|
|
|
export let csrf_failed_handler;
|
2018-08-04 15:40:25 +02:00
|
|
|
|
2021-02-28 00:48:19 +01:00
|
|
|
export function is_pending() {
|
2018-08-04 15:40:25 +02:00
|
|
|
return reload_pending;
|
2021-02-28 00:48:19 +01:00
|
|
|
}
|
2018-08-04 15:40:25 +02:00
|
|
|
|
2021-02-28 00:48:19 +01:00
|
|
|
export function is_in_progress() {
|
2018-08-04 15:40:25 +02:00
|
|
|
return reload_in_progress;
|
2021-02-28 00:48:19 +01:00
|
|
|
}
|
2018-08-04 15:40:25 +02:00
|
|
|
|
2021-02-28 00:48:19 +01:00
|
|
|
export function set_state_to_pending() {
|
2018-08-04 15:40:25 +02:00
|
|
|
// Why do we never set this back to false?
|
|
|
|
// Because the reload is gonna happen next. :)
|
|
|
|
// I was briefly confused by this, hence the comment.
|
|
|
|
reload_pending = true;
|
2021-02-28 00:48:19 +01:00
|
|
|
}
|
2018-08-04 15:40:25 +02:00
|
|
|
|
2021-02-28 00:48:19 +01:00
|
|
|
export function set_state_to_in_progress() {
|
2018-08-04 15:40:25 +02:00
|
|
|
reload_in_progress = true;
|
2021-02-28 00:48:19 +01:00
|
|
|
}
|
2021-03-10 02:39:50 +01:00
|
|
|
|
|
|
|
export function set_csrf_failed_handler(handler) {
|
|
|
|
csrf_failed_handler = handler;
|
|
|
|
}
|