mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 17:58:41 +00:00
Var to let and default parameters
This commit is contained in:
parent
1a7a2e6e2e
commit
78ee0b0e9c
|
|
@ -16,15 +16,17 @@
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
*/
|
*/
|
||||||
jsOMS.Request = function ()
|
jsOMS.Request = function (uri, method, type)
|
||||||
{
|
{
|
||||||
this.uri = null;
|
this.uri = typeof uri !== 'undefined' ? uri : null;
|
||||||
this.method = null;
|
this.method = typeof method !== 'undefined' ? method : jsOMS.EnumRequestMethod.GET;
|
||||||
this.requestHeader = [];
|
this.requestHeader = [];
|
||||||
this.success = null;
|
this.success = null;
|
||||||
this.type = jsOMS.EnumRequestMethod.GET;
|
this.type = typeof type !== 'undefined' ? type : 'json';
|
||||||
this.data = {};
|
this.data = {};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.xhr = new XMLHttpRequest();
|
this.xhr = new XMLHttpRequest();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -248,8 +250,8 @@
|
||||||
*/
|
*/
|
||||||
jsOMS.Request.prototype.queryfy = function (obj)
|
jsOMS.Request.prototype.queryfy = function (obj)
|
||||||
{
|
{
|
||||||
var str = [];
|
let str = [];
|
||||||
for (var p in obj) {
|
for (let p in obj) {
|
||||||
if (obj.hasOwnProperty(p)) {
|
if (obj.hasOwnProperty(p)) {
|
||||||
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
|
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
|
||||||
}
|
}
|
||||||
|
|
@ -269,12 +271,12 @@
|
||||||
*/
|
*/
|
||||||
jsOMS.Request.prototype.send = function ()
|
jsOMS.Request.prototype.send = function ()
|
||||||
{
|
{
|
||||||
var self = this;
|
let self = this;
|
||||||
|
|
||||||
if (self.xhr.readyState !== 1) {
|
if (self.xhr.readyState !== 1) {
|
||||||
self.xhr.open(this.method, this.uri);
|
self.xhr.open(this.method, this.uri);
|
||||||
|
|
||||||
for (var p in this.requestHeader) {
|
for (let p in this.requestHeader) {
|
||||||
if (this.requestHeader.hasOwnProperty(p)) {
|
if (this.requestHeader.hasOwnProperty(p)) {
|
||||||
self.xhr.setRequestHeader(p, this.requestHeader[p]);
|
self.xhr.setRequestHeader(p, this.requestHeader[p]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user