Hi,
I don't think I could send the sample script to reproduce the issue as it utilizes classes from many different files but I have attached the HTML file for the assertion palette below. I have checked that a non empty string is passed by the sample script to the function in the HTML file so I believe the error is not in the script. I hope this helps.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p id='p1'>Click the button below or use the "Send info to HTML" command in the ADD-INS panel.</p>
<!-- <button type='button' onclick='sendInfoToFusion()'>Click to send info to Fusion</button> -->
<br /><br />
</body>
<script>
function sendInfoToFusion(){
var args = {
arg1 : "Sample argument 1",
arg2 : "Sample argument 2"
};
adsk.fusionSendData('send', JSON.stringify(args));
}
window.fusionJavaScriptHandler = {handle: function(action, data){
try {
if (action == 'send') {
// Update a paragraph with the data passed in.
if(typeof(data)=="string"){
var string1 = data.substring(1, data.length-1);
var parent_list = string1.split("}");
var assertions_text = "Assertion Tracker <br>";
for(i=0; i<parent_list.length; i++){
var s = parent_list[i];
var parent = s.substring(1, s.indexOf(": ")-1);
assertions_text = assertions_text + parent + "<br>";
var assert_list = (s.substring("{"+1)).split(",");
for(i=0, i<assert_list.length; i++){
var t = assert_list[i];
var assertion = t.substring(1, s.indexOf(": ")-1);
var state = t.substring(t.indexOf(":")+1, t.length);
if(state.indexOf('false')!=-1){
state = "passed";
}
else{
state = "violated";
}
assertions_text = assertions_text + assertion + " " + state + "<br>";
}
}
document.getElementById('p1').innerHTML = assertions_text;
}
else{
document.getElementById('p1').innerHTML = typeof(data);
}
}
else if (action == 'debugger') {
debugger;
}
else {
return 'Unexpected command type: ' + action;
}
} catch (e) {
console.log(e);
console.log('exception caught with command: ' + action + ', data: ' + data);
}
return 'OK';
}};
</script>
</html>