Skip to content

TypeError: window is null #1

Description

@halcwb

I am trying your code in a webix app. However in the function:

function createWindowFromIframe(element) {
  var win = getWindowFromElement(element);
  var callbackKey = "create-blockly-" + (new Date).getTime();
  var iframeWin = null;
  win[callbackKey] = function(callbackWin) {
    delete win[callbackKey];
    iframeWin = callbackWin;
  };
  iframe({
    container: element,
    html: iframeHtml.replace("{{callbackKey}}", JSON.stringify(callbackKey))
  });
  return iframeWin;
}

iframeWin is of course null. Then in instantiateBrowserCode, the function is called with window = null resulting in the error:

function instantiateBrowserCode(code, window) {
  var mockGoog = {require: function(){}, provide: function(){}};
  var creator = new Function(["window", "document", "Blockly", "goog"], code);
  creator.apply(window, [window, window.document, window.Blockly, mockGoog]);
}

Am I missing something? See: https://github.com/halcwb/GenPDMS/blob/blockly/client/src/controllers/ruleEditor.js

P.s. $$("rule_editor").getNode() returns a regular div. In fact, an iframe in that div get's created!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions