Icontem

File: app/components/test-counter-hot/store/getters.js

Recommend this page to a friend!
  Classes of Sergey Beskorovayniy  >  Vuex Examples  >  app/components/test-counter-hot/store/getters.js  >  Download  
File: app/components/test-counter-hot/store/getters.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:
Date: 2 years ago
Size: 500 bytes
 

Contents

Class file image Download
define([], function () {
    var limit = 5;
    var getters = {
        count: function (state) {
            return state.count;
        },
        recentHistory: function (state) {
            var end = state.history.length;
            var begin = end - limit < 0 ? 0 : end - limit;
            var arr = state.history.slice(begin, end);
            var strArr = arr.toString();
            strArr = strArr.replace(/,/g, ', ');
            return strArr;
        }
    };
    return getters;
});