utils.js.coffee 402B

123456789101112131415
  1. class @Utils
  2. @navigatePath: (path) ->
  3. path = "/" + path unless path.match(/^\//)
  4. window.location.href = path
  5. @currentPath: ->
  6. window.location.href.replace(/https?:\/\/.*?\//g, '')
  7. @registerPage: (klass, options = {}) ->
  8. if options.forPathsMatching?
  9. if Utils.currentPath().match(options.forPathsMatching)
  10. window.currentPage = new klass()
  11. else
  12. new klass()