Skip to content

Commit

Permalink
better navigator environment detection for Node 21+
Browse files Browse the repository at this point in the history
  • Loading branch information
iamcal committed Jan 18, 2024
1 parent ad88166 commit a0e665c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
10 changes: 6 additions & 4 deletions build/emoji.js.template
Expand Up @@ -585,7 +585,7 @@
self.inits.env = 1;
self.replace_mode = 'img';
var supports_css = false;
if (typeof(navigator) !== 'undefined') {
if (typeof(navigator) !== 'undefined' && "userAgent" in navigator) {
var ua = navigator.userAgent;
if (typeof window !== 'undefined' && window.getComputedStyle){
try {
Expand All @@ -601,9 +601,11 @@
}
}
}
if (/ReactNative/i.test(navigator.product)){
self.replace_mode = 'unified';
return;
if ("product" in navigator){
if (/ReactNative/i.test(navigator.product)){
self.replace_mode = 'unified';
return;
}
}
if (ua.match(/(iPhone|iPod|iPad|iPhone\s+Simulator)/i)){
if (ua.match(/OS\s+[12345]/i)){
Expand Down
10 changes: 6 additions & 4 deletions lib/emoji.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/emoji.min.js

Large diffs are not rendered by default.

0 comments on commit a0e665c

Please sign in to comment.