mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
Add plugin to control playback speed like in YouTube (from 0.25 to 2)
This commit is contained in:
20
providers/dom-elements.js
Normal file
20
providers/dom-elements.js
Normal file
@ -0,0 +1,20 @@
|
||||
let domElements = {};
|
||||
|
||||
const watchDOMElement = (name, selectorFn, cb) => {
|
||||
const observer = new MutationObserver((mutations, observer) => {
|
||||
if (!domElements[name]) {
|
||||
domElements[name] = selectorFn(document);
|
||||
}
|
||||
|
||||
if (domElements[name]) {
|
||||
cb(domElements[name]);
|
||||
}
|
||||
});
|
||||
|
||||
observer.observe(document, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = { watchDOMElement };
|
||||
Reference in New Issue
Block a user