code: function processMessage(event) {
              var data = event['data'];
              var type = data['type'];
  
              switch (type) {
              case 'deriveAddressRange':
                  var addresses = deriveAddressRange(
                      data['node'],
                      data['firstIndex'],
                      data['lastIndex'],
                      data['version'],
                      data['addressFormat']
                  );
                  self.postMessage({
                      'addresses': addresses,
                      'firstIndex': data['firstIndex'],
                      'lastIndex': data['lastIndex'],
                      'i': data['i']
                  });
                  break;
              case 'deriveNode':
                  var node = deriveNode(
                      data['xpub'],
                      data['index'],
                      data['version']
                  );
                  self.postMessage({
                      'xpub': node,
                      'i': data['i']
                  });
                  break;
              default:
                  throw new Error('Unknown message type: ' + type);
              }
          }
docs: /*
  Web worker processing