Skip to content

Commit c048f80

Browse files
committed
Refactor some names
1 parent 6775d47 commit c048f80

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

background.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,24 +149,24 @@ function executeBookmarklet(bookmarklet){
149149
// Wait a navigation event.
150150
// If there is no navigation event, load a blob document with the returned value as document source
151151
if(value !== undefined){
152-
const unloadHandler = event => {
153-
window.removeEventListener("beforeunload", unloadHandler);
154-
// If the event has been prevented (by the )
152+
const beforeUnload = event => {
153+
window.removeEventListener("beforeunload", beforeUnload);
154+
// If the event has been prevented (by other any script)
155155
if(event.defaultPrevented){
156156
return;
157157
}
158-
clearTimeout(timeoutID);
158+
clearTimeout(timeout);
159159
};
160-
const timeoutHandler = () => {
161-
var a = new Blob([value], {type: "text/html;charset=utf-8"});
160+
const timeout = () => {
161+
const blob = new Blob([value], {type: "text/html;charset=utf-8"});
162162
// use blob instead of doc.open() write() close() which works only for HTML doc, not for XML (SVG) docs
163-
window.location = URL.createObjectURL(a);
163+
window.location = URL.createObjectURL(blob);
164164
};
165165
166166
// listen unload event to wait a potential navigation event
167-
window.addEventListener("beforeunload", unloadHandler);
167+
window.addEventListener("beforeunload", beforeUnload);
168168
// and set timeout to 100ms as fallback
169-
const timeoutID = setTimeout(timeoutHandler, 100);
169+
const unloadTimeoutID = setTimeout(timeout, 100);
170170
}
171171
}
172172
`;

0 commit comments

Comments
 (0)