1
0

index.js 481 B

12345678910111213141516171819202122232425
  1. import vuex from '../vuex'
  2. const data = require('./mock-data')
  3. const LATENCY = 16
  4. export function getAllMessages (cb) {
  5. setTimeout(() => {
  6. cb(data)
  7. }, LATENCY)
  8. }
  9. export function createMessage ({ text, thread }, cb) {
  10. const timestamp = Date.now()
  11. const id = 'm_' + timestamp
  12. const message = {
  13. id,
  14. text,
  15. timestamp,
  16. threadID: thread.id,
  17. threadName: thread.name,
  18. authorName: 'Evan'
  19. }
  20. setTimeout(function () {
  21. cb(message)
  22. }, LATENCY)
  23. }