@ribajs/core
Advanced tools
Comparing version 0.18.0 to 0.18.2
{ | ||
"name": "@ribajs/core", | ||
"description": "Core module of Riba.js", | ||
"version": "0.18.0", | ||
"version": "0.18.2", | ||
"author": "Pascal Garber <pascal@jumplink.eu>", | ||
@@ -34,3 +34,4 @@ "private": false, | ||
"doc": "harp server docs/_harp ./docs", | ||
"build-doc": "harp compile docs/_harp ./docs" | ||
"build-doc": "harp compile docs/_harp ./docs", | ||
"link": "npm install && npm link" | ||
}, | ||
@@ -45,3 +46,3 @@ "devDependencies": { | ||
"@babel/preset-typescript": "^7.1.0", | ||
"@types/jquery": "^3.3.28", | ||
"@types/jquery": "^3.3.29", | ||
"babel-loader": "^8.0.4", | ||
@@ -56,4 +57,4 @@ "babel-plugin-array-includes": "^2.0.3", | ||
"typescript": "^3.2.2", | ||
"uglifyjs-webpack-plugin": "^2.0.1", | ||
"webpack": "^4.28.0", | ||
"uglifyjs-webpack-plugin": "^2.1.0", | ||
"webpack": "^4.28.2", | ||
"webpack-cli": "^3.1.2" | ||
@@ -60,0 +61,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
import Debug from 'debug'; | ||
import { Debug } from '../../modules/debug.module'; | ||
@@ -3,0 +3,0 @@ const debuggurito = Debug('formatter'); |
@@ -322,8 +322,24 @@ import { JQuery } from '../modules'; | ||
/** | ||
* Set header for each xhr and jquery request | ||
* @param name Header name | ||
* @param value Hander value | ||
*/ | ||
public static setRequestHeaderEachRequest(name: string, value: string) { | ||
// TODO Are old values overwritten if JQuery.ajaxSetup called multiple times? | ||
JQuery.ajaxSetup({ | ||
beforeSend: (xhr: JQueryXHR) => { | ||
xhr.setRequestHeader(name, value); | ||
}, | ||
}); | ||
this._requestHeadersEachRequest.push({ | ||
name, | ||
value, | ||
}); | ||
} | ||
/** | ||
* Start an XMLHttpRequest() and return a Promise | ||
* | ||
* @memberOf Barba.Utils | ||
* @param {string} url | ||
* @param {number} xhrTimeout Time in millisecond after the xhr request goes in timeout | ||
* @return {Promise} | ||
* @param url | ||
* @param xhrTimeout Time in millisecond after the xhr request goes in timeout | ||
*/ | ||
@@ -350,3 +366,5 @@ public static xhr(url: string, xhrTimeout = 5000) { | ||
req.timeout = xhrTimeout; | ||
req.setRequestHeader('x-barba', 'yes'); | ||
for (const header of this._requestHeadersEachRequest) { | ||
req.setRequestHeader(header.name, header.value); | ||
} | ||
req.send(); | ||
@@ -524,2 +542,10 @@ | ||
/** | ||
* Header name value pair to send on each request | ||
*/ | ||
protected static _requestHeadersEachRequest: {name: string, value: string}[] = [{ | ||
name: 'x-barba', | ||
value: 'yes', | ||
}]; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2814011
335
34924