Skip to content

Commit

Permalink
move iOS check to a separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Nov 9, 2019
1 parent e62696a commit 1f90d0c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions packages/core-js/internals/is-ios.js
@@ -0,0 +1,3 @@
var userAgent = require('../internals/user-agent');

module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);
4 changes: 2 additions & 2 deletions packages/core-js/internals/microtask.js
Expand Up @@ -2,7 +2,7 @@ var global = require('../internals/global');
var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
var classof = require('../internals/classof-raw');
var macrotask = require('../internals/task').set;
var userAgent = require('../internals/user-agent');
var IS_IOS = require('../internals/is-ios');

var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
var process = global.process;
Expand Down Expand Up @@ -39,7 +39,7 @@ if (!queueMicrotask) {
process.nextTick(flush);
};
// browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
} else if (MutationObserver && !/(iphone|ipod|ipad).*applewebkit/i.test(userAgent)) {
} else if (MutationObserver && !IS_IOS) {
toggle = true;
node = document.createTextNode('');
new MutationObserver(flush).observe(node, { characterData: true });
Expand Down
4 changes: 2 additions & 2 deletions packages/core-js/internals/task.js
Expand Up @@ -4,7 +4,7 @@ var classof = require('../internals/classof-raw');
var bind = require('../internals/bind-context');
var html = require('../internals/html');
var createElement = require('../internals/document-create-element');
var userAgent = require('../internals/user-agent');
var IS_IOS = require('../internals/is-ios');

var location = global.location;
var set = global.setImmediate;
Expand Down Expand Up @@ -69,7 +69,7 @@ if (!set || !clear) {
};
// Browsers with MessageChannel, includes WebWorkers
// except iOS - https://github.com/zloirock/core-js/issues/624
} else if (MessageChannel && !/(iphone|ipod|ipad).*applewebkit/i.test(userAgent)) {
} else if (MessageChannel && !IS_IOS) {
channel = new MessageChannel();
port = channel.port2;
channel.port1.onmessage = listener;
Expand Down

0 comments on commit 1f90d0c

Please sign in to comment.