From 70a8bcd4df390378dc50514b889b1ca1ef4ec101 Mon Sep 17 00:00:00 2001 From: picklesrus Date: Tue, 4 Oct 2016 16:26:09 -0700 Subject: [PATCH] Add warning if you do not have required parts of closure available when loading BlocklyFactory. This should be temporary until #668 is fixed (#669) --- demos/blocklyfactory/app_controller.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/demos/blocklyfactory/app_controller.js b/demos/blocklyfactory/app_controller.js index a1d884706..ab7212f60 100644 --- a/demos/blocklyfactory/app_controller.js +++ b/demos/blocklyfactory/app_controller.js @@ -640,6 +640,20 @@ AppController.prototype.confirmLeavePage = function() { * Initialize Blockly and layout. Called on page load. */ AppController.prototype.init = function() { + // Blockly factory has a dependency on bits of closure that core blockly + // doesn't have. When you run this from file:// without a copy of closure, + // it breaks it non-obvious ways. Warning about this for now until the + // dependency is broken. + // TODO: #668. + if (!window.goog.dom.xml) { + alert('Sorry: Closure dependency not found. We are working on removing ' + + 'this dependency. In the meantime, you can use our hosted demo\n ' + + 'https://blockly-demo.appspot.com/static/demos/blocklyfactory/index.html' + + '\nor use these instructions to continue running locally:\n' + + 'https:developers.google.com/blockly/guides/modify/web/closure'); + return; + } + // Handle Blockly Storage with App Engine if ('BlocklyStorage' in window) { this.initializeBlocklyStorage();