forked from kriasoft/react-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Intl polyfill for unsupported clients [closes kriasoft#639]
- Loading branch information
Showing
3 changed files
with
28 additions
and
9 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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
import main from './client'; | ||
|
||
function run() { | ||
// Run the application when both DOM is ready and page content is loaded | ||
if (['complete', 'loaded', 'interactive'].includes(document.readyState) && document.body) { | ||
main(); | ||
} else { | ||
document.addEventListener('DOMContentLoaded', main, false); | ||
} | ||
} | ||
|
||
if (!global.Intl) { | ||
require.ensure([ | ||
'intl', | ||
'intl/locale-data/jsonp/en.js', | ||
'intl/locale-data/jsonp/cs.js', | ||
], require => { | ||
require('intl'); | ||
require('intl/locale-data/jsonp/en.js'); | ||
require('intl/locale-data/jsonp/cs.js'); | ||
run(); | ||
}, 'intl'); | ||
} else { | ||
run(); | ||
} |
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