30
31 document.getElementById("render-disableTags").value = renderOptions.disableTags;
32 document.getElementById("render-disableTags").onchange = async (e) => {
33 const browserSyncData = await chrome.storage.sync.get();34 browserSyncData.iconRenderOptions.disableTags = Number(e.target.value);
35 await chrome.storage.sync.set(browserSyncData);
36 }
23
24 document.getElementById("render-size").value = renderOptions.size;
25 document.getElementById("render-size").onchange = async (e) => {
26 const browserSyncData = await chrome.storage.sync.get();27 browserSyncData.iconRenderOptions.size = Number(e.target.value);
28 await chrome.storage.sync.set(browserSyncData);
29 }
207 showSelector = false;
208 toggleSelector(false);
209 }
210 catch(e)211 {
212 logger.error(e);
213 }
258 makeStatsFromInput(currentChatText);
259 toggleSelector(false);
260 }
261 catch(e)262 {
263 logger.error(e);
264 }
324 * 매치된 아이콘이 없었으면 그냥 텍스트 요소로 추가
325 */
326 if (textStartIndex < tokenIndex && tokens.slice(textStartIndex, tokenIndex).join(" ").length > 0) {
327 const text = document.createElement("span");328 text.classList.add("text-fragment");
329 text.setAttribute("data-a-target", "chat-message-text");
330 text.replaceChildren(tokens.slice(textStartIndex, tokenIndex).join(" "));
Two variables can have the same name if they're declared in different scopes.
In the example below, the parameter x
is said to "shadow" the variable x
declared above it.
The outer x
can no longer be accessed inside the sum
function.
const x = 1
function add(x, y) {
return x + y
}
While shadowing does not cause any problems most of the time, it does make the code harder to read and understand. We highly recommend against shadowing. However, if you want to shadow some variable name and don't want DeepSource to flag it, add a skipcq comment alongside an explanation:
const x = 1
function add(x, y) { // skipcq: JS-0123 - `x` can be safely shadowed
return x + y
}
If you want to disable this issue project-wide, you can add it to the list of disabled issues in the project dashboard.
const file = "data.txt"
function readFile(file) {
// The parameter `file` shadows the toplevel variable `file`.
if (fs.existsSync(file)) {
return fs.readFileSync(file)
}
return null
}
// Prefer variable names that are distinct and convey as much
// meaning as possible.
const dataFile = "data.txt"
function readFile(filePath) {
if (fs.existsSync(filePath)) {
return fs.readFileSync(filePath)
}
return null
}
Alternatively:
const file = "data.txt"
function readFile(file) { // skipcq: JS-0123 - Shadowing is safe here
// ...
}