mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
perf(): raf updates
This commit is contained in:
@@ -6,7 +6,12 @@ const nativeCancelRaf = window.cancelAnimationFrame ||
|
||||
window.webkitCancelAnimationFrame ||
|
||||
window.webkitCancelRequestAnimationFrame;
|
||||
|
||||
export const raf = nativeRaf || function(callback) {
|
||||
export function raf(callback) {
|
||||
//console.log('raf', callback.toString().replace(/\s/g, '').replace('function', '').substring(0, 50));
|
||||
_raf(callback);
|
||||
}
|
||||
|
||||
const _raf = nativeRaf || function(callback) {
|
||||
let timeCurrent = (new Date()).getTime(),
|
||||
timeDelta;
|
||||
|
||||
@@ -31,7 +36,7 @@ export function rafFrames(framesToWait, callback) {
|
||||
|
||||
if (framesToWait < 2) {
|
||||
raf(callback);
|
||||
|
||||
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
raf(callback);
|
||||
|
||||
@@ -21,12 +21,12 @@ export class FeatureDetect {
|
||||
let featureDetects = {};
|
||||
|
||||
|
||||
FeatureDetect.add('sticky', function(window, document) {
|
||||
// css position sticky
|
||||
let ele = document.createElement('div');
|
||||
ele.style.cssText = 'position:-webkit-sticky;position:sticky';
|
||||
return ele.style.position.indexOf('sticky') > -1;
|
||||
});
|
||||
// FeatureDetect.add('sticky', function(window, document) {
|
||||
// // css position sticky
|
||||
// let ele = document.createElement('div');
|
||||
// ele.style.cssText = 'position:-webkit-sticky;position:sticky';
|
||||
// return ele.style.position.indexOf('sticky') > -1;
|
||||
// });
|
||||
|
||||
|
||||
FeatureDetect.add('hairlines', function(window, document, body) {
|
||||
|
||||
Reference in New Issue
Block a user