File: app/components/test-chat/api/index.js

Recommend this page to a friend!
  Classes of Sergey Beskorovayniy   Vuex Examples   app/components/test-chat/api/index.js   Download  
File: app/components/test-chat/api/index.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Vuex Examples
Example apps using Vuex state management pattern
Author: By
Last change: Update of app/components/test-chat/api/index.js
Date: 2 years ago
Size: 763 bytes
 

Contents

Class file image Download
define([ 'app/components/test-chat/api/mock-data', ], function (data) { var LATENCY = 16; var getAllMessages = function (cb) { return setTimeout(function () { cb(data); }, LATENCY); }; var createMessage = function (text, thread, cb) { var timestamp = Date.now(); var id = 'm_' + timestamp; var message = { id: id, text: text, timestamp: timestamp, threadID: thread.id, threadName: thread.name, authorName: 'Evan' }; setTimeout(function () { cb(message); }, LATENCY); }; return { getAllMessages: getAllMessages, createMessage: createMessage }; });