mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
6e075c78bf
refs https://linear.app/tryghost/issue/CORE-104/decouple-frontend-routing-events-from-urlserver-events - URL module is part of the backend heavily dependent on the model and fits perfectly here. Frontend should get the data it needs by passing a URL manager instance to it
32 lines
805 B
JavaScript
32 lines
805 B
JavaScript
const urlService = require('../../core/server/services/url');
|
|
|
|
module.exports.isFinished = async (options = {disableDbReadyEvent: false}) => {
|
|
let timeout;
|
|
|
|
return new Promise(function (resolve) {
|
|
(function retry() {
|
|
clearTimeout(timeout);
|
|
|
|
if (urlService.hasFinished()) {
|
|
return resolve();
|
|
}
|
|
|
|
timeout = setTimeout(retry, 50);
|
|
})();
|
|
});
|
|
};
|
|
|
|
// @TODO: unify all the reset/softTeset helpers so they either work how the main code works or the reasons why they are different are clear
|
|
module.exports.init = () => {
|
|
urlService.init();
|
|
};
|
|
|
|
module.exports.reset = () => {
|
|
urlService.softReset();
|
|
},
|
|
|
|
module.exports.resetGenerators = () => {
|
|
urlService.resetGenerators();
|
|
urlService.resources.reset();
|
|
};
|