Hey!
Ok, so put this in "lay options" -> "custom css & html" -> "Custom <head> content"
<script> window.laytheme.on("newpageshown", function(layoutObj, type, obj){ console.log(obj) }); </script>Go to the page where you want to run your javascript and open the console:
https://developers.google.com/web/tools/chrome-devtools/console/#opening_the_console
You will see a js object like that:
0_1499868878005_Screen Shot 2017-07-12 at 16.14.05.png
So in my example I can say
<script> window.laytheme.on("newpageshown", function(layoutObj, type, obj){ if(obj.slug == "test-2"){ //do javascript here } }); </script>Ok this is just to execute javascript for specific pages. I'm really not sure if that will make it work with processing. Have you tried this processing js too? http://processingjs.org/learning/