save and load state
This commit is contained in:
		| @ -50,10 +50,18 @@ function sendMessage(tab, req, log, cond, interval, limit = 0) { | ||||
|     }); | ||||
| } | ||||
|  | ||||
| chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) { | ||||
|     if (!message.action || !message.action.startsWith(EXT_NAME)) { | ||||
| chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) { | ||||
|     if (!request.action || !request.action.startsWith(EXT_NAME)) { | ||||
|         return; | ||||
|     } | ||||
|     sendResponse("Calling from user pages is not allowed."); | ||||
|     return; | ||||
|     switch (request.action) { | ||||
|         case ACTION_UPLOAD_STATE: | ||||
|             sendResponse('recieved!'); | ||||
|             __EXTRACTOR_STATE__ = request.state; | ||||
|             console.log(`State (${request.name}) recieved. Use following to load it: \nsome_var = new Extractor().load()`); | ||||
|             break; | ||||
|         default: | ||||
|             sendResponse("Request not supported."); | ||||
|             break; | ||||
|     } | ||||
| }); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user