A couple API tweaks to request:

For the pce object, let's use this design pattern (with all-lowercase event names, easier to remember).

pce.on('load', function() { console.log('loaded'); });
pce.on('runcomplete', function() { console.log('run completed'); });
pce.on('dirty', function(text) { console.log('text edited to be' + text); });

Ideally (but optionally) we'd implement the standard behavior of allowing multiple callbacks to be registered on the same event.

In this comment, let's also document that dirty is passed the text as its first arg.

When we invoke an event handler, then let's invoke it like this this._onLoadHandler.apply(this, args) so that the "this" is the pce object itself.

Finally, let's make it super-easy to read the current code out of the pce in the normal case.

When the "dirty" event is fired, let's have the pce object cache a _lastSeenText (which should probably also be set when setCode is called), and then have a pce.getCode() method that returns it.