stats.js 262 B

1234567891011121314151617
  1. const stats = new Map()
  2. exports.get = (type, id) => {
  3. let dic = stats.get(type)
  4. if (!dic) {
  5. dic = new Map()
  6. stats.set(type, dic)
  7. }
  8. let stat = dic.get(id)
  9. if (!stat) {
  10. stat = {
  11. value: 0
  12. }
  13. dic.set(id, stat)
  14. }
  15. return stat
  16. }