summaryrefslogtreecommitdiff
path: root/demos/12-manual-code-splitting-b.example.js
blob: c5a08cab3485c8b1fc699dc6c351fcbacf2897bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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]
    }
  }
})()