mirror of
https://github.com/processing/processing4.git
synced 2026-01-30 03:41:15 +01:00
20 lines
457 B
JavaScript
20 lines
457 B
JavaScript
|
|
// wait for document to load
|
|
window.onload = function () {
|
|
tryFindSketch();
|
|
}
|
|
|
|
// find sketch instance
|
|
function tryFindSketch () {
|
|
var sketch = Processing.getInstanceById(getProcessingSketchID());
|
|
if ( sketch == undefined )
|
|
setTimeout( tryFindSketch, 200 ); // try again in 0.2 secs
|
|
else
|
|
sketch.setJS( this );
|
|
}
|
|
|
|
// called from inside the sketch
|
|
function promtForInput ( msg, def ) {
|
|
return window.prompt( msg, def );
|
|
}
|