'Manifest v3 content security policy service worker hot reload
I am in the process of converting my manifest two chrome extension to manifest 3. I am proceeding nicely, except for one item that is driving me crazy. That item is a hot reload of the service worker during debugging. I am currently reloading the extension, which is painful for debugging. I have read that setting up a hot reload in the manifest is possible. I have tried several entries in the manifest file, but none had any effect. Could somebody point me in the correct direction? It seems like there is conflicting information all over the web. A sample of a manifest would be greatly appreciated.
Thanks, Tom
Solution 1:[1]
You could try something like the code below. I use a regular expression to find the phrase you are looking for then the number that immediately follows the search phrase. I believe you can write the regular expression to exclude the search string from the results and just return the number, but I've never been very good with RegEx so, instead, I split the string up by each word and then grab the last word, which is the number, represented by X in your question. That should hopefully give you a start to figure out how you'd like to solve it.
for (var i = 0; i < threads.length; i++) {
// creates a regular expressiom that finds the phrase "reimbursed your account" and number that immedatly follows it
let regExp = new RegExp('reimbursed your account [0-9]+');
// assign the message text to a variable
let message = messages[i][0].getPlainBody();
// executes the regular expression on the message variable and stores the results in a new array called phrase
let phrase = regExp.exec(message);
// I assume the search phrase will only apprear once in the email. If appears more than once, you'll need to loop through pharse and deal with each instance appropriately.
// split the string into an array at every space in the string, pop off the last value (the number) and store it in num variable
let num = phrase[0].split(" ").pop()
body.push([num, I]);
}
mysheet.getRange(8686, 19, threads.length, 2).setValues(body);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tyler Baker |
