DEV: Correctly clear global exported variables

This commit is contained in:
Jarek Radosz 2022-08-22 21:46:30 +02:00 committed by Alan Guo Xiang Tan
parent 258e9b22dd
commit 349f6e18f3
6 changed files with 12 additions and 9 deletions

View File

@ -9,7 +9,7 @@ export function addTopicTitleDecorator(decorator) {
}
export function resetTopicTitleDecorators() {
topicTitleDecorators = [];
topicTitleDecorators.length = 0;
}
export default Component.extend(KeyEnterEscape, {

View File

@ -108,6 +108,6 @@ export function addSectionLink(args, secondary) {
}
export function resetDefaultSectionLinks() {
customSectionLinks = [];
secondaryCustomSectionLinks = [];
customSectionLinks.length = 0;
secondaryCustomSectionLinks.length = 0;
}

View File

@ -10,5 +10,5 @@ export function addSidebarSection(func) {
}
export function resetSidebarSection() {
customSections.splice(0, customSections.length);
customSections.length = 0;
}

View File

@ -60,5 +60,5 @@ export function registerUserMenuTab(func) {
}
export function resetUserMenuTabs() {
CUSTOM_TABS_CLASSES.clear();
CUSTOM_TABS_CLASSES.length = 0;
}

View File

@ -120,7 +120,7 @@ export function setTestPresence(value) {
}
export function clearPresenceCallbacks() {
callbacks.splice(0, callbacks.length);
callbacks.length = 0;
}
if (!isTesting()) {

View File

@ -17,8 +17,8 @@ const LIKE_ACTION = 2;
const VIBRATE_DURATION = 5;
const _builders = {};
let _extraButtons = {};
export let apiExtraButtons = {};
let _extraButtons = {};
let _buttonsToRemove = {};
export function addButton(name, builder) {
@ -26,9 +26,12 @@ export function addButton(name, builder) {
}
export function resetPostMenuExtraButtons() {
_buttonsToRemove = {};
apiExtraButtons = {};
for (const key of Object.keys(apiExtraButtons)) {
delete apiExtraButtons[key];
}
_extraButtons = {};
_buttonsToRemove = {};
}
export function removeButton(name, callback) {