Fix: isInit -> initialized
This commit is contained in:
parent
29f5daa912
commit
3011ba836d
|
@ -10,20 +10,24 @@ function createAppliesToLineWidget(cm) {
|
||||||
];
|
];
|
||||||
const THROTTLE_DELAY = 400;
|
const THROTTLE_DELAY = 400;
|
||||||
let widgets = [];
|
let widgets = [];
|
||||||
let fromLine, toLine, gutterStyle, isInit;
|
let fromLine, toLine, gutterStyle;
|
||||||
|
let initialized = false;
|
||||||
|
|
||||||
return {toggle};
|
return {toggle};
|
||||||
|
|
||||||
function toggle(state = !isInit) {
|
function toggle(newState = !initialized) {
|
||||||
if (!isInit && state) {
|
newState = Boolean(newState);
|
||||||
|
if (newState !== initialized) {
|
||||||
|
if (newState) {
|
||||||
init();
|
init();
|
||||||
} else if (isInit && !state) {
|
} else {
|
||||||
uninit();
|
uninit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
isInit = true;
|
initialized = true;
|
||||||
|
|
||||||
gutterStyle = getComputedStyle(cm.getGutterElement());
|
gutterStyle = getComputedStyle(cm.getGutterElement());
|
||||||
fromLine = null;
|
fromLine = null;
|
||||||
|
@ -39,7 +43,7 @@ function createAppliesToLineWidget(cm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function uninit() {
|
function uninit() {
|
||||||
isInit = false;
|
initialized = false;
|
||||||
|
|
||||||
widgets.forEach(clearWidget);
|
widgets.forEach(clearWidget);
|
||||||
widgets.length = 0;
|
widgets.length = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user