summaryrefslogtreecommitdiff
path: root/demos/12-manual-code-splitting-b.example.js
blob: 1754f2577bb242d0a131eb49f964a4cce1f25b9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// 12-manual-code-splitting-b.example.js
let AccountModule = (function() {
  let customerBalance = {}
  return {
    adjustCustomerBalance: function(customerId, delta) {
      let customer = customerBalance[customerId]
      if (customer) {
        customerBalance[customerId] += delta
      } else customerBalance[customerId] = delta
    },
    getCustomerBalance: function(customerId) {
      return customerBalance[customerId]
    }
  }
})()