MCPcopy
hub / github.com/apify/crawlee / useState

Method useState

packages/basic-crawler/src/internals/basic-crawler.ts:1137–1140  ·  view source on GitHub ↗
(defaultValue = {} as State)

Source from the content-addressed store, hash-verified

1135 }
1136
1137 async useState<State extends Dictionary = Dictionary>(defaultValue = {} as State): Promise<State> {
1138 const kvs = await KeyValueStore.open(null, { config: this.config });
1139 return kvs.getAutoSavedValue<State>(BasicCrawler.CRAWLEE_STATE_KEY, defaultValue);
1140 }
1141
1142 protected get pendingRequestCountApproximation(): number {
1143 return this.requestManager?.getPendingCount() ?? 0;

Callers 3

requestHandlerFunction · 0.80

Calls 2

getAutoSavedValueMethod · 0.80
openMethod · 0.45

Tested by 1

requestHandlerFunction · 0.64