diff --git a/app/gist/controller.js b/app/gist/controller.js index 428dda56..471be69f 100644 --- a/app/gist/controller.js +++ b/app/gist/controller.js @@ -24,6 +24,12 @@ export default Em.Controller.extend({ */ buildErrors: null, + /** + * Whether user wishes the code to automatically run + * @type {boolean} + */ + isAutorun: true, + /** * Build the application and set the iframe code */ @@ -59,8 +65,10 @@ export default Em.Controller.extend({ } }), - rebuildApp: Em.observer('model.files.@each.content', function() { - Em.run.debounce(this, this.buildApp, 500); + rebuildApp: Em.observer('model.files.@each.content', 'isAutorun', function() { + if (this.get('isAutorun')) { + Em.run.debounce(this, this.buildApp, 500); + } }), actions: { @@ -68,6 +76,10 @@ export default Em.Controller.extend({ this.set('activeEditor', editor); }, + runNow () { + this.buildApp(); + }, + deleteGist (gist) { gist.destroyRecord(); this.transitionToRoute('gist.new'); diff --git a/app/gist/template.hbs b/app/gist/template.hbs index 67f1d36a..388b7aa3 100644 --- a/app/gist/template.hbs +++ b/app/gist/template.hbs @@ -97,7 +97,7 @@