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() { export function resetTopicTitleDecorators() {
topicTitleDecorators = []; topicTitleDecorators.length = 0;
} }
export default Component.extend(KeyEnterEscape, { export default Component.extend(KeyEnterEscape, {

View File

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

View File

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

View File

@ -60,5 +60,5 @@ export function registerUserMenuTab(func) {
} }
export function resetUserMenuTabs() { 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() { export function clearPresenceCallbacks() {
callbacks.splice(0, callbacks.length); callbacks.length = 0;
} }
if (!isTesting()) { if (!isTesting()) {

View File

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