happeing "TypeError" than using "autoRefresh" addon when setting on change event

happeing “TypeError” than using “autoRefresh” addon when setting on change event

I have used autorefresh addon.
( https://codemirror.net/addon/display/autorefresh.js )
And I have set on change event.
Than Codemirror occured when I edited codemirror’s textarea.

Error:
TypeError: f is undefined
codemirror.js
function signalLater
function bnd(f) {return function(){f.apply(null, args);};};

My code:

$('.codemirror').each(function() {
  var updateTextArea, cm;
  updateTextArea = function(e) {
    var id;
    id = $(e).attr("id");
    return cm.operation(function() {
      $(e).text(cm.getValue()).change();
      cm.save();
    });
  };
  cm = CodeMirror.fromTextArea(this, {
    theme: theme_name,
    lineWrapping: true,
    lineNumbers: false,
    matchBrackets: true,
    styleActiveLine: true,
    autoRefresh: true,
  });
  cm.on('change', updateTextArea(this));
  cm.refresh();
});

You’re passing the result of calling updateTextArea, which is undefined, as an event handler. That’s where the error comes from.

marjin, Thank you your answer! I can get big hint for to solve the question.