'use strict'
_ = require 'underscore'
Backbone = require 'backbone'
EventBroker = require 'chaplin/lib/event_broker'
utils = require 'chaplin/lib/utils'
mediator = require 'chaplin/mediator'
module.exports = class Controller'use strict'
_ = require 'underscore'
Backbone = require 'backbone'
EventBroker = require 'chaplin/lib/event_broker'
utils = require 'chaplin/lib/utils'
mediator = require 'chaplin/mediator'
module.exports = class ControllerBorrow the static extend method from Backbone.
@extend = Backbone.Model.extendMixin Backbone events and EventBroker.
_.extend @prototype, Backbone.Events
_.extend @prototype, EventBroker
view: nullInternal flag which stores whether redirectTo
was called in the current action.
redirected: false
constructor: ->
@initialize arguments...
initialize: ->Empty per default.
beforeAction: -> adjustTitle: (subtitle) ->
mediator.execute 'adjustTitle', subtitleConvenience method to publish the !composer:compose event. See the
composer for information on parameters, etc.
reuse: (name) ->
method = if arguments.length is 1 then 'retrieve' else 'compose'
mediator.execute "composer:#{method}", arguments...Deprecated method.
compose: ->
throw new Error 'Controller#compose was moved to Controller#reuse'Redirect to URL.
redirectTo: (pathDesc, params, options) ->
@redirected = true
utils.redirectTo pathDesc, params, options disposed: false
dispose: ->
return if @disposedDispose and delete all members which are disposable.
for own prop, obj of this when obj and typeof obj.dispose is 'function'
obj.dispose()
delete this[prop]Unbind handlers of global events.
@unsubscribeAllEvents()Unbind all referenced handlers.
@stopListening()Finished.
@disposed = trueYou're frozen when your heart’s not open.
Object.freeze? this