Skip to content

Commit

Permalink
add jsReturn capsule attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewekeller committed Aug 11, 2022
1 parent 370b4a5 commit b28ba42
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
32 changes: 24 additions & 8 deletions desktopContext.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Copyright 2021 to WebRocketX under the

// GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
// See license file for more details

// version 1.8 06/25/2022
// version 1.9 08/11/2022

// hash change event management
var currentHashId = "";
Expand Down Expand Up @@ -271,6 +272,7 @@ function DesktopContext(){
thisInstance.getPreviousStackId = getPreviousStackId;
thisInstance.back = back;
thisInstance.processJsOnload = processJsOnload;
thisInstance.processJsReturn = processJsReturn;
thisInstance.setPageTitle = setPageTitle;
thisInstance.safeRemoveAllChildElements = safeRemoveAllChildElements;

Expand Down Expand Up @@ -573,6 +575,7 @@ function DesktopContext(){

} else {
thisInstance.injectCapsule(capsuleToShow,browserBackButtonDriven,"setCapsuleById");
thisInstance.processJsReturn(capsuleToShow);
}
} else {
//handle appropriately
Expand Down Expand Up @@ -626,18 +629,31 @@ function DesktopContext(){

function processJsOnload(capsule) {

// capsule onload
var onloadMethod = capsule.getAttribute("jsOnload");
if ( (onloadMethod!=null) && (onloadMethod!="") ) {
var jsOnloadMethod = capsule.getAttribute("jsOnload");
if ( (jsOnloadMethod!=null) && (jsOnloadMethod!="") ) {
try {
var jsOnloadMethodWrapped = Function("capsule",jsOnloadMethod);
jsOnloadMethodWrapped(capsule);
}
catch (e) {
alert("Javascript jsOnload failed. Method="+jsOnloadMethod+" Error message="+e.message);
}
}
}

function processJsReturn(capsule) {

var jsReturnMethod = capsule.getAttribute("jsReturn");
if ( (jsReturnMethod!=null) && (jsReturnMethod!="") ) {
try {
var onloadFunctionWrapped = Function("capsule",onloadMethod);
onloadFunctionWrapped(capsule);
var jsReturnMethodWrapped = Function("capsule",jsReturnMethod);
jsReturnMethodWrapped(capsule);
}
catch (e) {
alert("Javascript onload failed. Method="+onloadMethod+" Error message="+e.message);
alert("Javascript jsReturn failed. Method="+jsReturnMethod+" Error message="+e.message);
}
}
}
}
}

// simplified methods for developer use -----------------------------
Expand Down
3 changes: 2 additions & 1 deletion domUtil.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Copyright 2021 to WebRocketX under the

// GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
// See license file for more details

// version 1.8 06/25/2022
// version 1.9 08/11/2022

function DomUtil(){
var me = this;
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Copyright 2021 to WebRocketX under the
GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
See license file for more details

Version 1.8
Version 1.9 08/11/2022
2 changes: 1 addition & 1 deletion webRocketXStyles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
See license file for more details
*/

/* version 1.8 06/25/2022 */
/* version 1.9 08/11/2022 */

.BDT_Dialog_Layer {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion webapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
// See license file for more details

// version 1.8 06/25/2022
// version 1.9 08/11/2022

function AsyncRequest() {
this.successCallbackReference = null;
Expand Down

0 comments on commit b28ba42

Please sign in to comment.