lion/packages/ajax/src/ajax.js
2021-02-10 15:42:37 +01:00

14 lines
621 B
JavaScript

import { AjaxClient } from './AjaxClient.js';
export let ajax = new AjaxClient(); // eslint-disable-line import/no-mutable-exports
/**
* setAjax allows the Application Developer to override the globally used instance of {@link:ajax}.
* All interactions with {@link:ajax} after the call to setAjax will use this new instance
* (so make sure to call this method before dependant code using {@link:ajax} is ran and this
* method is not called by any of your (indirect) dependencies.)
* @param {AjaxClient} newAjax the globally used instance of {@link:ajax}.
*/
export function setAjax(newAjax) {
ajax = newAjax;
}