Sha256: d5a5b93e4bbbc46d6bad634d3f68b9717655314e835daf9b3cbb82d554e2818a

Contents?: true

Size: 1.25 KB

Versions: 20

Compression:

Stored size: 1.25 KB

Contents

define 'aura/extensions/routes', (routes) ->

  'use strict'

  # TODO Remove .call null
  # TODO Remove .call null
  loader.require.call null, 'modernizr'
  loader.require.call null, 'ened/vendor/assets/javascripts/lennon/lennon.js'
  query  = loader.require.call null, 'querystring'
  router = null

  (application) ->
    core     = application.core
    mediator = core.mediator

    # TODO unify router api
    router = new Lennon
      # TODO implement logger api for lennon or change lennon library
      # logger: application.logger
      publishEvent: (name, params) ->
        # TODO method parsing (get, delete, put, post)
        mediator.emit name, params


    router.location = (href) ->
      if Modernizr.history
        window.history.pushState null, null, href
      else
        # TODO parse href and extract path!
        window.location.hash = href

      router.process()

    application.core.router = router

    location = Object.create null,
      # TODO cache query parsing
      query:
        get: -> query.parse window.location.search.substring(1)

      toString: -> window.location

    version: '0.2.0'

    initialize: (application) ->
      application.sandbox.location = location

    afterAppStart: (application) ->
      router.process()

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ende-0.2.12 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.2.11 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.2.10 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.2.9 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.2.8 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.2.7 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.2.6 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.2.5 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.2.4 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.2.3 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.2.2 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.2.1 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.2.0 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.1.14 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.1.13 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.1.12 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.1.11 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.1.10 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.1.9 lib/assets/javascripts/aura/extensions/routes.js.coffee
ende-0.1.8 lib/assets/javascripts/aura/extensions/routes.js.coffee