MCPcopy
hub / github.com/angular/angular / updateClient

Method updateClient

packages/service-worker/worker/src/driver.ts:550–577  ·  view source on GitHub ↗
(client: Client)

Source from the content-addressed store, hash-verified

548 }
549
550 async updateClient(client: Client): Promise<boolean> {
551 // Figure out which version the client is on. If it's not on the latest,
552 // it needs to be moved.
553 const existing = this.clientVersionMap.get(client.id);
554 if (existing === this.latestHash) {
555 // Nothing to do, this client is already on the latest version.
556 return false;
557 }
558
559 // Switch the client over.
560 let previous: Object | undefined = undefined;
561
562 // Look up the application data associated with the existing version. If there
563 // isn't any, fall back on using the hash.
564 if (existing !== undefined) {
565 const existingVersion = this.versions.get(existing)!;
566 previous = this.mergeHashWithAppData(existingVersion.manifest, existing);
567 }
568
569 // Set the current version used by the client, and sync the mapping to disk.
570 this.clientVersionMap.set(client.id, this.latestHash!);
571 await this.sync();
572
573 // Notify the client about this activation.
574 const current = this.versions.get(this.latestHash!)!;
575
576 return true;
577 }
578
579 private async handleFetch(event: FetchEvent): Promise<Response> {
580 try {

Callers 4

handleMessageMethod · 0.95
assignVersionMethod · 0.95
happy_spec.tsFile · 0.80
data_spec.tsFile · 0.80

Calls 4

mergeHashWithAppDataMethod · 0.95
syncMethod · 0.95
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected