<commit_before>// Google BSD license http://code.google.com/google_bsd_license.html
// Copyright 2011 Google Inc. <EMAIL>

/*globals define window*/

define(['editor/editorInterface', 'MetaObject/q/q', 'MetaObject/q-comm/q-comm'],
function(editorInterface, Q, Q_COMM) {

function buildPromisingCalls(iface, impl) {
  var stub = {};
  Object.keys(iface).forEach(function(method) {
    stub[method] = impl.invoke.bind(stub, method);
  });
  return stub;
}

function stubber(iframe, commands, eventHandler) {
  var qStub = Q_COMM.Connection(iframe.contentWindow, eventHandler, {origin: window.location.origin});
  return buildPromisingCalls(commands, qStub);
}

var editorStubber =  function(iframe, editorEventHandler) {
  return stubber(iframe, editorInterface.commands, editorEventHandler);
};

var EditorInserter = {

  'interface' : {
    open: function(where, url, line, col) {
        var editor = this.insertEditor(where);
        editor.open(url, line, col);
    }
  },
  
  insertEditor: function (where) {
      this.iframe = this.insertIframe(where, 'editor/index.html');
      return editorStubber(this.iframe, {});
  },
  
  insertIframe: function(where, url) {
    var iframe = window.document.createElement('iframe');
    iframe.setAttribute('src', url);
    where.appendChild(iframe);
    return iframe;
  }
};

return EditorInserter;

});<commit_msg>correct the url and camelCase<commit_after>// Google BSD license http://code.google.com/google_bsd_license.html
// Copyright 2011 Google Inc. <EMAIL>

/*globals define window*/

define(['editor/editorInterface', 'MetaObject/q/q', 'MetaObject/q-comm/q-comm'],
function(editorInterface, Q, Q_COMM) {

function buildPromisingCalls(iface, impl) {
  var stub = {};
  Object.keys(iface).forEach(function(method) {
    stub[method] = impl.invoke.bind(stub, method);
  });
  return stub;
}

function stubber(iframe, commands, eventHandler) {
  var qStub = Q_COMM.Connection(iframe.contentWindow, eventHandler, {origin: window.location.origin});
  return buildPromisingCalls(commands, qStub);
}

var editorStubber =  function(iframe, editorEventHandler) {
  return stubber(iframe, editorInterface.commands, editorEventHandler);
};

var editorInserter = {

  'interface' : {
    open: function(where, url, line, col) {
        var editor = editorInserter.insertEditor(where);
        editor.open(url, line, col);
    }
  },
  
  insertEditor: function (where) {
      this.iframe = this.insertIframe(where, '../editor/index.html');
      return editorStubber(this.iframe, {});
  },
  
  insertIframe: function(where, url) {
    var iframe = window.document.createElement('iframe');
    iframe.setAttribute('src', url);
    where.appendChild(iframe);
    return iframe;
  }
};

return editorInserter;

});
{'fraction_non_alphanumeric': 0.1417180137731062, 'fraction_numerical': 0.002899601304820587, 'mean_word_length': 4.328185328185328, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4477895', 'n_tokens_mistral': 890, 'n_tokens_neox': 874, 'n_words': 176}