Skip to content

Commit

Permalink
Merge 625f694 into 5301fc5
Browse files Browse the repository at this point in the history
  • Loading branch information
hems committed Aug 14, 2013
2 parents 5301fc5 + 625f694 commit 905736a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion www/src/theoricus/core/process.coffee
Expand Up @@ -108,7 +108,7 @@ module.exports = class Process
after_run()

# sets the callback
@controller.after_render = @after_run
@controller.done_rendering = @after_run

# executes action
@controller[ action ] @params
Expand Down
20 changes: 12 additions & 8 deletions www/src/theoricus/mvc/controller.coffee
Expand Up @@ -18,9 +18,14 @@ Fetcher = require 'theoricus/mvc/lib/fetcher'
###
module.exports = class Controller

###*
Injected by {Process}, called after rendering procedure is finished,
so {Processes} can go ahead and process the next pending one.
@property {Function} done_rendering
###
@param [theoricus.Theoricus] @the Shortcut for app's instance
###
done_rendering: null

###*
This function is executed by the Factory. It saves a `@the` reference inside the controller.
Expand Down Expand Up @@ -77,8 +82,8 @@ module.exports = class Controller

@process.view = view

view.process = @process
view.after_in = @after_render
view.process = @process
view.after_in = @done_rendering

if data instanceof Fetcher
if data.loaded
Expand All @@ -89,7 +94,6 @@ module.exports = class Controller
else
view._render data


# ~> Shortcuts

###*
Expand Down Expand Up @@ -118,8 +122,8 @@ module.exports = class Controller
# kill current running process
do @process.processes.active_processes.pop

# fires after_render prematurely to wipe the fresh glue
@after_render()
# fires done_rendering prematurely so we can unlock
@done_rendering()

# and redirects user
@the.processes.router.navigate url
@the.processes.router.navigate url

0 comments on commit 905736a

Please sign in to comment.