Fixed some DemoView issues, mainly clicking links from one demo to another.

This commit is contained in:
Scott Erickson 2014-07-17 16:29:26 -07:00
parent 4658c3000f
commit 74425103d1

View file

@ -35,6 +35,7 @@ module.exports = DemoView = class DemoView extends CocoView
@loadDemoingLibs() unless DemoView.loaded @loadDemoingLibs() unless DemoView.loaded
loadDemoingLibs: -> loadDemoingLibs: ->
DemoView.loaded = true
@queue = new createjs.LoadQueue() @queue = new createjs.LoadQueue()
@queue.on('complete', @scriptsLoaded, @) @queue.on('complete', @scriptsLoaded, @)
window.jasmine = {} # so that mock-ajax properly loads. It expects jasmine to be loaded window.jasmine = {} # so that mock-ajax properly loads. It expects jasmine to be loaded
@ -81,8 +82,14 @@ module.exports = DemoView = class DemoView extends CocoView
view = demoFunc() view = demoFunc()
return unless view return unless view
@$el.find('#demo-area').empty().append(view.$el) @$el.find('#demo-area').empty().append(view.$el)
view.afterInsert()
# TODO, maybe handle root views differently than modal views differently than everything else? # TODO, maybe handle root views differently than modal views differently than everything else?
getAllDemoFiles: -> getAllDemoFiles: ->
allFiles = window.require.list() allFiles = window.require.list()
(f for f in allFiles when f.indexOf('.demo') > -1) (f for f in allFiles when f.indexOf('.demo') > -1)
destroy: ->
# hack to get jasmine tests to properly run again on clicking links, and make sure if you
# leave this page (say, back to the main site) that test stuff doesn't follow you.
document.location.reload()