Shared
Workers
extendedLifetime
demo

With extendedLifetime

You will see the previous result after reload.

Result: 0

Without extendedLifetime

You may not see the previous result after reload if no other windows open.

Result: 0

This demo is based on https://github.com/mdn/dom-examples/tree/main/web-workers/simple-shared-worker, and modified for supporting the extendedLifetime option.
Please close the page, and reopen to see if the SharedWorker instance continues.