-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Prevent using localization API before initialization
It could happen that the window.Typo3Neos.I18n.translate has been used before the initialization flag was set. This change prevents this. fix #26
- Loading branch information
1 parent
822131e
commit ee96c92
Showing
3 changed files
with
33 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,39 @@ | ||
import 'core-js/stable' | ||
import 'regenerator-runtime/runtime' | ||
import { UserModule, UserMenu } from './Components' | ||
import { isNil } from './Helper' | ||
import {UserModule, UserMenu} from './Components' | ||
import {isNil} from './Helper' | ||
|
||
document.addEventListener('DOMContentLoaded', function () { | ||
const userModuleContainer = document.querySelector( | ||
'.neos-module-administration-users' | ||
) | ||
if (!isNil(userModuleContainer)) { | ||
Array.from(userModuleContainer.querySelectorAll('.neos-table')).forEach( | ||
(_userModule) => { | ||
if (!isNil(_userModule)) { | ||
new UserModule(_userModule) | ||
const initialize = () => { | ||
const userModuleContainer = document.querySelector( | ||
'.neos-module-administration-users' | ||
) | ||
if (!isNil(userModuleContainer)) { | ||
Array.from(userModuleContainer.querySelectorAll('.neos-table')).forEach( | ||
(_userModule) => { | ||
if (!isNil(_userModule)) { | ||
new UserModule(_userModule) | ||
} | ||
} | ||
} | ||
) | ||
} | ||
|
||
const userMenuContainer = document.querySelector( | ||
'#neos-top-bar .neos-user-menu' | ||
) | ||
if (!isNil(userMenuContainer)) { | ||
new UserMenu(userMenuContainer) | ||
} | ||
} | ||
|
||
const userMenuContainer = document.querySelector( | ||
'#neos-top-bar .neos-user-menu' | ||
) | ||
if (!isNil(userMenuContainer)) { | ||
new UserMenu(userMenuContainer) | ||
if (window.Typo3Neos.I18n.initialized) { | ||
initialize() | ||
} else { | ||
const interval = setInterval(() => { | ||
if (window.Typo3Neos.I18n.initialized) { | ||
clearInterval(interval) | ||
initialize() | ||
} | ||
}, 50) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.