File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 11import eventManager from '../utils/eventManager.js' ;
2- import { global } from '../utils/global.js' ;
2+ import { global , globalSet } from '../utils/global.js' ;
33
44eventManager . on ( ':loaded' , ( ) => {
5- if ( global ( 'translationReady' , { throws : false } ) ) {
5+ const READY = 'translationReady' ;
6+ if ( global ( READY , { throws : false } ) ) {
67 eventManager . singleton . emit ( 'translation:loaded' ) ;
78 } else {
8- document . addEventListener ( 'translationReady' , ( ) => {
9+ document . addEventListener ( READY , ( ) => {
910 eventManager . singleton . emit ( 'translation:loaded' ) ;
1011 } , {
1112 once : true ,
1213 } ) ;
14+ // Fallback for if translation function breaks
15+ eventManager . on ( ':load' , ( ) => {
16+ const translationReady = global ( READY , { throws : false } ) ;
17+ if ( translationReady !== false ) return ;
18+ globalSet ( READY , true ) ;
19+ document . dispatchEvent ( global ( 'translationEvent' ) ) ;
20+ } ) ;
1321 }
1422} ) ;
You can’t perform that action at this time.
0 commit comments