From 843342d188e02343ee12a428f3358264a119e883 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 11 Dec 2016 02:00:37 +0100 Subject: [PATCH] add reset method to ajax object --- resources/assets/typescript/Sakura/AJAX.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/resources/assets/typescript/Sakura/AJAX.ts b/resources/assets/typescript/Sakura/AJAX.ts index f796852..e8d4d9d 100644 --- a/resources/assets/typescript/Sakura/AJAX.ts +++ b/resources/assets/typescript/Sakura/AJAX.ts @@ -13,10 +13,7 @@ namespace Sakura // Prepares the XMLHttpRequest and stuff constructor(async: boolean = true) { - this.Request = new XMLHttpRequest(); - this.Callbacks = new Object(); - this.Headers = new Object(); - this.Asynchronous = async; + this.Reset(async); } // Start @@ -51,6 +48,15 @@ namespace Sakura this.Request = null; } + public Reset(async: boolean = true): void { + this.Request = new XMLHttpRequest(); + this.Callbacks = new Object(); + this.Headers = new Object(); + this.Send = null; + this.FormData = null; + this.Asynchronous = async; + } + // Set content type required for forms public Form(): void { this.ContentType("application/x-www-form-urlencoded");