Comparing version 1.1.0-beta to 1.1.0-beta.1
@@ -8,4 +8,10 @@ "use strict"; | ||
var _default = global.cancelAnimationFrame || global.webkitCancelAnimationFrame || global.mozCancelAnimationFrame || global.oCancelAnimationFrame || global.msCancelAnimationFrame || global.clearTimeout; | ||
var _getGlobal = _interopRequireDefault(require("../getGlobal")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var g = (0, _getGlobal.default)(); | ||
var _default = g.cancelAnimationFrame || g.webkitCancelAnimationFrame || g.mozCancelAnimationFrame || g.oCancelAnimationFrame || g.msCancelAnimationFrame || g.clearTimeout; | ||
exports.default = _default; |
@@ -8,4 +8,10 @@ "use strict"; | ||
var _default = global.requestAnimationFrame || global.webkitRequestAnimationFrame || global.mozRequestAnimationFrame || global.oRequestAnimationFrame || global.msRequestAnimationFrame; | ||
var _getGlobal = _interopRequireDefault(require("../getGlobal")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var g = (0, _getGlobal.default)(); | ||
var _default = g.requestAnimationFrame || g.webkitRequestAnimationFrame || g.mozRequestAnimationFrame || g.oRequestAnimationFrame || g.msRequestAnimationFrame; | ||
exports.default = _default; |
@@ -12,22 +12,28 @@ "use strict"; | ||
var _getGlobal = _interopRequireDefault(require("../getGlobal")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var g = (0, _getGlobal.default)(); | ||
var lastTime = 0; | ||
/** | ||
* Here is the native and polyfill version of requestAnimationFrame. | ||
* Please don't use it directly and use requestAnimationFrame module instead. | ||
*/ | ||
var requestAnimationFrame = _nativeRequestAnimationFrame.default && _nativeRequestAnimationFrame.default.bind(global) || function (callback) { | ||
function _setTimeout(callback) { | ||
var currTime = Date.now(); | ||
var timeDelay = Math.max(0, 16 - (currTime - lastTime)); | ||
lastTime = currTime + timeDelay; | ||
return global.setTimeout(function () { | ||
return g.setTimeout(function () { | ||
callback(Date.now()); | ||
}, timeDelay); | ||
}; // Works around a rare bug in Safari 6 where the first request is never invoked. | ||
} | ||
/** | ||
* Here is the native and polyfill version of requestAnimationFrame. | ||
* Please don't use it directly and use requestAnimationFrame module instead. | ||
*/ | ||
var requestAnimationFrame = _nativeRequestAnimationFrame.default && _nativeRequestAnimationFrame.default.bind(g) || _setTimeout; // Works around a rare bug in Safari 6 where the first request is never invoked. | ||
requestAnimationFrame(_emptyFunction.default); | ||
var _default = requestAnimationFrame; | ||
exports.default = _default; |
@@ -12,3 +12,3 @@ "use strict"; | ||
if (!_query.canUseDOM) { | ||
return null; | ||
return {}; | ||
} | ||
@@ -15,0 +15,0 @@ |
@@ -12,4 +12,7 @@ "use strict"; | ||
var _getGlobal = _interopRequireDefault(require("../getGlobal")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var g = (0, _getGlobal.default)(); | ||
var TRANSFORM = (0, _getVendorPrefixedName.default)('transform'); | ||
@@ -20,3 +23,3 @@ var BACKFACE_VISIBILITY = (0, _getVendorPrefixedName.default)('backfaceVisibility'); | ||
if (_BrowserSupportCore.default.hasCSSTransforms()) { | ||
var ua = global.window ? global.window.navigator.userAgent : 'UNKNOWN'; | ||
var ua = g.window ? g.window.navigator.userAgent : 'UNKNOWN'; | ||
var isSafari = /Safari\//.test(ua) && !/Chrome\//.test(ua); // It appears that Safari messes up the composition order | ||
@@ -23,0 +26,0 @@ // of GPU-accelerated layers |
{ | ||
"name": "dom-lib", | ||
"version": "1.1.0-beta", | ||
"version": "1.1.0-beta.1", | ||
"description": "DOM helper library", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
// @flow | ||
export default global.cancelAnimationFrame || | ||
global.webkitCancelAnimationFrame || | ||
global.mozCancelAnimationFrame || | ||
global.oCancelAnimationFrame || | ||
global.msCancelAnimationFrame || | ||
global.clearTimeout; | ||
import getGlobal from '../getGlobal'; | ||
const g = getGlobal(); | ||
export default g.cancelAnimationFrame || | ||
g.webkitCancelAnimationFrame || | ||
g.mozCancelAnimationFrame || | ||
g.oCancelAnimationFrame || | ||
g.msCancelAnimationFrame || | ||
g.clearTimeout; |
// @flow | ||
export default global.requestAnimationFrame || | ||
global.webkitRequestAnimationFrame || | ||
global.mozRequestAnimationFrame || | ||
global.oRequestAnimationFrame || | ||
global.msRequestAnimationFrame; | ||
import getGlobal from '../getGlobal'; | ||
const g = getGlobal(); | ||
export default g.requestAnimationFrame || | ||
g.webkitRequestAnimationFrame || | ||
g.mozRequestAnimationFrame || | ||
g.oRequestAnimationFrame || | ||
g.msRequestAnimationFrame; |
@@ -5,5 +5,16 @@ // @flow | ||
import emptyFunction from '../utils/emptyFunction'; | ||
import getGlobal from '../getGlobal'; | ||
const g = getGlobal(); | ||
let lastTime = 0; | ||
function _setTimeout(callback: Function) { | ||
var currTime = Date.now(); | ||
var timeDelay = Math.max(0, 16 - (currTime - lastTime)); | ||
lastTime = currTime + timeDelay; | ||
return g.setTimeout(() => { | ||
callback(Date.now()); | ||
}, timeDelay); | ||
} | ||
/** | ||
@@ -14,11 +25,3 @@ * Here is the native and polyfill version of requestAnimationFrame. | ||
const requestAnimationFrame = | ||
(nativeRequestAnimationFrame && nativeRequestAnimationFrame.bind(global)) || | ||
(callback => { | ||
var currTime = Date.now(); | ||
var timeDelay = Math.max(0, 16 - (currTime - lastTime)); | ||
lastTime = currTime + timeDelay; | ||
return global.setTimeout(() => { | ||
callback(Date.now()); | ||
}, timeDelay); | ||
}); | ||
(nativeRequestAnimationFrame && nativeRequestAnimationFrame.bind(g)) || _setTimeout; | ||
@@ -25,0 +28,0 @@ // Works around a rare bug in Safari 6 where the first request is never invoked. |
@@ -5,3 +5,3 @@ import { canUseDOM } from '../query'; | ||
if (!canUseDOM) { | ||
return null; | ||
return {}; | ||
} | ||
@@ -8,0 +8,0 @@ |
@@ -5,3 +5,5 @@ // @flow | ||
import getVendorPrefixedName from '../getVendorPrefixedName'; | ||
import getGlobal from '../getGlobal'; | ||
const g = getGlobal(); | ||
const TRANSFORM = getVendorPrefixedName('transform'); | ||
@@ -12,3 +14,3 @@ const BACKFACE_VISIBILITY = getVendorPrefixedName('backfaceVisibility'); | ||
if (BrowserSupportCore.hasCSSTransforms()) { | ||
let ua = global.window ? global.window.navigator.userAgent : 'UNKNOWN'; | ||
let ua = g.window ? g.window.navigator.userAgent : 'UNKNOWN'; | ||
let isSafari = /Safari\//.test(ua) && !/Chrome\//.test(ua); | ||
@@ -15,0 +17,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110803
112
3145