How to reference ProseMirror object in event

Hi, how do I reference the ProseMirror object in an event handler without using global variables? In the final JavaScript, the signal function looks like this:

signal: function signal(type) {
  var arr = this._handlers && this._handlers[type];

  for (var _len = arguments.length, values = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    values[_key - 1] = arguments[_key];

  if (arr) for (var i = 0; i < arr.length; ++i) {
    arr[i].apply(arr, values);

The first argument to apply is the array of function callbacks, so even if I registered an object method as the event handler, I can’t use this inside of it to reference that object.

You make your event handler function close over it.