mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-16 01:08:41 +00:00
Fixing global variables
This commit is contained in:
parent
2deb520fb9
commit
80b9dbdf9f
|
|
@ -54,6 +54,8 @@
|
||||||
length = scripts.length;
|
length = scripts.length;
|
||||||
|
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
|
/** global: URL */
|
||||||
|
/** @var {string} URL */
|
||||||
scripts[i].src.replace(URL + '/', '');
|
scripts[i].src.replace(URL + '/', '');
|
||||||
|
|
||||||
if (jsOMS.Autoloader.loaded.indexOf(scripts[i].src) === -1) {
|
if (jsOMS.Autoloader.loaded.indexOf(scripts[i].src) === -1) {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,6 @@
|
||||||
throw 'Division zero';
|
throw 'Division zero';
|
||||||
}
|
}
|
||||||
|
|
||||||
return values.reduce((a, b) => a + b, 0) / count;
|
return values.reduce((a, b) => a + b, 0) / length;
|
||||||
};
|
};
|
||||||
}(window.jsOMS = window.jsOMS || {}));
|
}(window.jsOMS = window.jsOMS || {}));
|
||||||
|
|
@ -26,6 +26,8 @@
|
||||||
this.success = null;
|
this.success = null;
|
||||||
this.type = typeof type !== 'undefined' ? type : jsOMS.Message.Response.ResponseType.JSON;
|
this.type = typeof type !== 'undefined' ? type : jsOMS.Message.Response.ResponseType.JSON;
|
||||||
this.data = {};
|
this.data = {};
|
||||||
|
|
||||||
|
/** global: XMLHttpRequest */
|
||||||
this.xhr = new XMLHttpRequest();
|
this.xhr = new XMLHttpRequest();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
* @license OMS License 1.0
|
* @license OMS License 1.0
|
||||||
* @version 1.0.0 * @since 1.0.0
|
* @version 1.0.0 * @since 1.0.0
|
||||||
*/
|
*/
|
||||||
(function (uriFactory, undefined)
|
(function (jsOMS)
|
||||||
{
|
{
|
||||||
/** @namespace jsOMS.Message.Response */
|
/** @namespace jsOMS.Message.Response */
|
||||||
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Response');
|
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Response');
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@
|
||||||
case 'table':
|
case 'table':
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -92,7 +91,7 @@
|
||||||
{
|
{
|
||||||
this.clearDatalistOptions(datalist);
|
this.clearDatalistOptions(datalist);
|
||||||
|
|
||||||
let request = new Request();
|
let request = new jsOMS.Message.Request();
|
||||||
request.setData(input.value);
|
request.setData(input.value);
|
||||||
request.setType(jsOMS.Message.Response.ResponseType.JSON);
|
request.setType(jsOMS.Message.Response.ResponseType.JSON);
|
||||||
request.setUri(datalist.getAttribute('data-list-src'));
|
request.setUri(datalist.getAttribute('data-list-src'));
|
||||||
|
|
@ -102,7 +101,7 @@
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
let o = JSON.parse(xhr.response),
|
let o = JSON.parse(xhr.response),
|
||||||
response = new Response(o),
|
response = new jsOMS.Message.Response(o),
|
||||||
responseLength = response.count(),
|
responseLength = response.count(),
|
||||||
tempResponse = null,
|
tempResponse = null,
|
||||||
success = null;
|
success = null;
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
document.addEventListener('keyup', function keyBind(event)
|
document.addEventListener('keyup', function keyBind(event)
|
||||||
{
|
{
|
||||||
if (self.down.length > 0) {
|
if (self.down.length > 0) {
|
||||||
self.run(element);
|
self.run(element, event);
|
||||||
self.down = [];
|
self.down = [];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -76,11 +76,12 @@
|
||||||
* Execute callback based on key presses.
|
* Execute callback based on key presses.
|
||||||
*
|
*
|
||||||
* @param {string} element Container id
|
* @param {string} element Container id
|
||||||
|
* @param {Object} event Key event
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
*/
|
*/
|
||||||
jsOMS.UI.Input.Keyboard.KeyboardManager.prototype.run = function (element)
|
jsOMS.UI.Input.Keyboard.KeyboardManager.prototype.run = function (element, event)
|
||||||
{
|
{
|
||||||
if (typeof this.elements[element] === 'undefined') {
|
if (typeof this.elements[element] === 'undefined') {
|
||||||
throw 'Unexpected elmenet!';
|
throw 'Unexpected elmenet!';
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
* @license OMS License 1.0
|
* @license OMS License 1.0
|
||||||
* @version 1.0.0 * @since 1.0.0
|
* @version 1.0.0 * @since 1.0.0
|
||||||
*/
|
*/
|
||||||
(function (uriFactory, undefined)
|
(function (jsOMS)
|
||||||
{
|
{
|
||||||
/** @namespace jsOMS.Uri.UriFactory */
|
/** @namespace jsOMS.Uri.UriFactory */
|
||||||
jsOMS.Autoloader.defineNamespace('jsOMS.Uri.UriFactory');
|
jsOMS.Autoloader.defineNamespace('jsOMS.Uri.UriFactory');
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,7 @@
|
||||||
*/
|
*/
|
||||||
jsOMS.isNode = function (ele)
|
jsOMS.isNode = function (ele)
|
||||||
{
|
{
|
||||||
|
/** global: Node */
|
||||||
return (
|
return (
|
||||||
typeof Node === "object" ? ele instanceof Node :
|
typeof Node === "object" ? ele instanceof Node :
|
||||||
ele && typeof ele === "object" && typeof ele.nodeType === "number" && typeof ele.nodeName === "string"
|
ele && typeof ele === "object" && typeof ele.nodeType === "number" && typeof ele.nodeName === "string"
|
||||||
|
|
@ -216,6 +217,7 @@
|
||||||
*/
|
*/
|
||||||
jsOMS.isElement = function (o)
|
jsOMS.isElement = function (o)
|
||||||
{
|
{
|
||||||
|
/** global: HTMLElement */
|
||||||
return (
|
return (
|
||||||
typeof HTMLElement === "object" ? o instanceof HTMLElement : o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName === "string"
|
typeof HTMLElement === "object" ? o instanceof HTMLElement : o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName === "string"
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user