Added a possible Callback to filFromURI

This commit is contained in:
Florian Bouillon 2019-10-08 17:35:59 +02:00
parent 36c41446ea
commit 5f3ba54ccf
No known key found for this signature in database
GPG Key ID: B143FF27EF555D16

View File

@ -310,13 +310,14 @@ export default class FormManager {
* @param {string} uri the URI
* @memberof FormManager
*/
public fillFromURI(uri: string) {
public fillFromURI(uri: string, callback?: () => void) {
let ajax = new XMLHttpRequest
ajax.open("GET", uri, true)
ajax.addEventListener("loadend", (e) => {
if (ajax.readyState === 4 && ajax.status === 200) {
let json = JSON.parse(ajax.responseText)
this.fillFromJSON(json)
if (callback != undefined) callback()
}
})
ajax.send()