Forum > Pas2JS
How to call external JS script?
d-_-b:
Why not use a asm block?
But read "Why are asm blocks bad".
Below is a fully working pas2js example, note Result is case-sensitive in the asm block!
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var val: jsvalue;function movementQueryWorld: jsvalue;begin asm Result = window.movementQuery(world) // https://github.com/NateTheGreatt/bitECS/blob/master/docs/INTRO.md#-query end;end;begin val:= movementQueryWorld(); writeln('From Pascal', val);end.
zendrael:
Thank you all!
Solved by creating a wrapper in JS and on Pascal with calls for external wrapper functions. This way I can change whatever is needed in the wrapper and keep the calls in Pascal.
Thank you for all the help!
Navigation
[0] Message Index
[*] Previous page