Skip to content

Client Code Layout

Akseli Palén edited this page Feb 12, 2017 · 7 revisions

Note difference:

  • Models vs functional DAL
  • Events and state: location events vs content entries

Views

  • Component, initialized with DOM node.
  • Emits 'rendered'
  • Takes care of requesting data and stuff.

DAL for Server API: Stores & Event listeners:

  • Events store (is api)
  • Users store (is api)
  • Markers store (is api and also a cache)
  • Location store (is api and also a cache)

Routes

Structure:

  • stores/
    • locations.js, singleton
    • users.js, singleton
    • events.js, singleton
  • views/
  • app.js
  • router.js, singleton
  • index.html
  • index.js

stores/events.js:

  • init(callback)
  • getRecent(page, num, callback)
  • getOlderThan(time, num, callback)

stores/locations.js

  • init(callback)
  • getOne

stores/account.js

  • getToken()
  • login()
  • logout()
  • changePassword()
  • sendResetPasswordEmail
  • resetPassword
  • sendInviteEmail
  • signup(token, username, password, callback)
  • isLoggedIn()
  • getToken()
  • getUser()
  • getName()

stores/mapStateStore.js

  • init(defaultState)
  • update(state)
  • isEmpty()
  • get()

connection/io.js

  • init(callback)
  • get()

connection/storage.js

  • module for localstorage
Clone this wiki locally