Skip to content

Commit

Permalink
The arguments passed in the "callback" were reversed, and task proper…
Browse files Browse the repository at this point in the history
…ties were no longer used as an argument in them. In the "chat" example, the "logout" callback is no longer necessary and has been removed.
  • Loading branch information
mrhdias committed Apr 1, 2024
1 parent 2f935e9 commit 6d0d70b
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 13 deletions.
Binary file modified dist/js/ext/websocket.min.js.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions dist/js/secutio.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
secutio.js
Author: Henrique Dias
Last Modification: 2024-03-25 19:10:51
Last Modification: 2024-04-01 18:20:24
Attention: This is work in progress
References:
Expand Down Expand Up @@ -769,7 +769,7 @@
if (!this.callbacks.hasOwnProperty(properties.callback)) {
throw new Error(`The registered callback "${properties.callback}" not exist!`);
}
const result = this.callbacks[properties.callback](event, properties);
const result = this.callbacks[properties.callback](event);
if (result === false) {
if (properties.hasOwnProperty('next')) {
delete properties.next;
Expand Down
2 changes: 1 addition & 1 deletion dist/js/secutio.min.js

Large diffs are not rendered by default.

Binary file modified dist/js/secutio.min.js.gz
Binary file not shown.
8 changes: 1 addition & 7 deletions examples/chat/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,7 @@
if (newUserElem.value.length > 2) {
event.data = { 'user': newUserElem.value };
document.getElementById("myself").value = newUserElem.value;
}
}));

app.callback_register('logout', ((event, properties) => {
const user = document.getElementById("myself").value;
if (user.length > 2) {
properties["action"] = `logout/${user}`;
document.getElementById("logout").setAttribute('data-action', `logout/${newUserElem.value}`);
}
}));

Expand Down
2 changes: 1 addition & 1 deletion examples/chat/public/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
},
"logout": {
"action": "logout",
"attribute-action": "data-action",
"method": "delete",
"callback": "logout",
"trigger": "click",
"target": "#main",
"template": "#login-dialog-tpl",
Expand Down
4 changes: 2 additions & 2 deletions src/js/secutio.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
secutio.js
Author: Henrique Dias
Last Modification: 2024-03-25 19:10:51
Last Modification: 2024-04-01 18:20:24
Attention: This is work in progress
References:
Expand Down Expand Up @@ -769,7 +769,7 @@
if (!this.callbacks.hasOwnProperty(properties.callback)) {
throw new Error(`The registered callback "${properties.callback}" not exist!`);
}
const result = this.callbacks[properties.callback](event, properties);
const result = this.callbacks[properties.callback](event);
if (result === false) {
if (properties.hasOwnProperty('next')) {
delete properties.next;
Expand Down

0 comments on commit 6d0d70b

Please sign in to comment.