JavaScript API Example: registerAddListener()

Here is the code which:
  1. Registers the listener function (called "listener")
  2. Each time an object is made, adds it to the list (if it's a Point).
Using SetValue[] makes the list static. You could use Append[] if you want a dynamic list instead
function ggbOnInit() { ggbApplet.registerAddListener("listener"); } function listener(obj) { if (ggbApplet.getObjectType(obj) == "point") { ggbApplet.evalCommand("SetValue[list, Length[list] + 1, " + obj + "]"); } }