diff --git a/Event/EventManager.js b/Event/EventManager.js index 04eab18..238588e 100644 --- a/Event/EventManager.js +++ b/Event/EventManager.js @@ -103,7 +103,7 @@ export class EventManager { { if (this.callbacks.hasOwnProperty(group)) { return this.triggerSingleEvent(group, id, data); - }p + } const allGroups = Object.keys(this.callbacks), regex = new RegExp(group), diff --git a/Model/Action/Dom/Reload.js b/Model/Action/Dom/Reload.js new file mode 100644 index 0000000..b80dbcf --- /dev/null +++ b/Model/Action/Dom/Reload.js @@ -0,0 +1,19 @@ +/** + * Reload dom. + * + * @param {Object} action Action data + * @param {function} callback Callback + * @param {string} id Action element + * + * @since 1.0.0 + */ +export function reloadButtonAction (action, callback, id) +{ + "use strict"; + + setTimeout(function () { + document.location.reload(true); + }, parseInt(action.delay)); + + callback(); +}; diff --git a/Model/Action/Event/Prevent.js b/Model/Action/Event/Prevent.js index 1fd513b..f84b429 100644 --- a/Model/Action/Event/Prevent.js +++ b/Model/Action/Event/Prevent.js @@ -11,6 +11,8 @@ export function preventEvent (action, callback, id) { "use strict"; + console.log('prevented'); + jsOMS.preventAll(action.data); callback(); diff --git a/Model/Action/Message/Request.js b/Model/Action/Message/Request.js index 5d5a9f7..3fdbf0e 100644 --- a/Model/Action/Message/Request.js +++ b/Model/Action/Message/Request.js @@ -1,3 +1,6 @@ +import { Request } from '../../../Message/Request/Request.js'; + + /** * Set message. * @@ -11,7 +14,7 @@ export function requestAction (action, callback) "use strict"; /** global: jsOMS */ - const request = new jsOMS.Message.Request.Request(action.uri, action.method, action.request_type); + const request = new Request(action.uri, action.method, action.request_type); request.setSuccess(function(xhr) { console.log(xhr.responseText); diff --git a/UI/ActionManager.js b/UI/ActionManager.js index 6e09b80..bfe7d7e 100644 --- a/UI/ActionManager.js +++ b/UI/ActionManager.js @@ -18,6 +18,7 @@ export class ActionManager { */ constructor(app) { + this.logger = Logger.getInstance(); this.app = app; this.actions = {}; }; @@ -55,7 +56,7 @@ export class ActionManager { bindElement (e) { if (!jsOMS.isValidJson(e.getAttribute('data-action'))) { - jsOMS.Log.Logger.instance.error('Invalid json string: \'' + e.getAttribute('data-action') + '\''); + this.logger.error('Invalid json string: \'' + e.getAttribute('data-action') + '\''); return; } @@ -122,7 +123,7 @@ export class ActionManager { for (let j = 1; j < actionLength; ++j) { if (typeof id === 'undefined' || typeof listener.key === 'undefined') { - jsOMS.Log.Logger.instance.error('Invalid element id/key: ' + id + '/' + listener.key); + this.logger.error('Invalid element id/key: ' + id + '/' + listener.key); return; } @@ -162,7 +163,7 @@ export class ActionManager { const self = this; if (!this.actions.hasOwnProperty(action.type)) { - jsOMS.Log.Logger.instance.warning('Undefined action ' + action.type); + this.logger.warning('Undefined action ' + action.type); return; }