YouTube CPU Tamer by AnimationFrame

Reduce Browser's Energy Impact for playing YouTube Video

Pada tanggal 30 Agustus 2021. Lihat %(latest_version_link).

Penulis
𝖢𝖸 𝖥𝗎𝗇𝗀
Nilai
0 0 0
Versi
2021.08.30
Dibuat
29 Agustus 2021
Diperbarui
30 Agustus 2021
Size
5,91 KB
Lisensi
MIT
Berlaku untuk

Inspired by kona's YouTube CPU Tamer

Description

This is for all kinds of YouTube applications, including main page, embedded video, and live chat.

- Faster
- More Stable
- Lower Battery Consumption

Note1: This hijacks to setTimeout, setInterval, clearTimeout, clearInterval
Note2: This uses setInterval(..., 250ms) instead of requestAnimationFrame for background running.

Remarks

This userscript hijacks setTimeout & setInterval leading different browser behaviors as follows:

Case 1

let f=function(){console.log('hello world')};
setTimeout(f,100);setTimeout(f,100);setTimeout(f,100);

Native: print out "hello world" 3 times.
Modified: print out "hellow world" 1 time.

Case 2

let f=function(){console.log('hello world')};
setTimeout(f,100);setTimeout(f,110);setTimeout(f,120);

Native: print out "hello world" 3 times.
Modified: print out "hellow world" 1 ~ 3 time(s) depending on execution time of f and AnimationFrame's segregation;

Case 3

let f=function(){console.log('hello world')};
setTimeout(f,100);setTimeout(f,200);setTimeout(f,300);

Native: print out "hello world" 3 times.
Modified: print out "hello world" 3 times.

长期地址
遇到问题?请前往 GitHub 提 Issues。