diff --git a/readme.md b/readme.md index be9f6d9..584bed6 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,7 @@ All you need to do is: - Find out the selectors for target data - Type scripts in the console of `extension backgroud page`, as introduced bellow. - ![](images/console.png) + ![](template/assets/console.png) ## Qucik Start @@ -52,10 +52,7 @@ function (itemsSelector:string, fieldSelectors:string[], urls:ExtractResult) ## Stop Tasks -The only way to stop tasks before its finish, is `Closing the target tab`. - -> Tasks wait for their target elements' appearance, given some elements were loaded asynchronously. -> If you typed wrong selectors, the task waits forever for elements which don't exists. +Close the target tab, in which current tasks is running. ## Extract Attributes. @@ -126,17 +123,17 @@ e.export(1) Sometimes, it's hard to finish them in an single execution, that why we need "Continuing of Tasks". -You can always continue tasks (with following), even it stops in the middle of a task: +You can always continue tasks by start it again, not matter in what phase it stops. ```js e.start() ``` -The `Extractor` kept the state of last execution, and starts from where it stopped. +The `Extractor` kept the execution state, and starts from where it stopped. ### Restart Tasks -What should I do, if I don't like to continue from last state, but restart from certain task? +What if I don't like to continue from last state, but restart certain tasks? ```js // restart all tasks @@ -166,12 +163,15 @@ e.save(); Load the state: -Open the popup window, upload the saved state file. Then, and in the backgoud console: +Open the popup window, upload the saved state file. Then, and in the backgroud console: ```js e = new Extractor().load(); +e.start(); ``` +> The uploaded state will be cleaned in 30 seconds, if you don't load it. + ## Developpment Clone this project and execute: diff --git a/src/background/caches.ts b/src/background/caches.ts index 0ee3be2..b99f5fb 100644 --- a/src/background/caches.ts +++ b/src/background/caches.ts @@ -11,5 +11,12 @@ export class Caches { setState(name: string, content: string) { this._state = content; logger.info(`State (${name}) recieved. To load it: some_var = new Extractor().load()`); + // clear cache in 30 seconds + setTimeout(() => { + if (this._state) { + logger.info(`Uploaded state is cleaned after 30 second.`); + this._state = ""; + } + }, 30000); } } \ No newline at end of file