mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
Fix dark mode event handling
Previous code worked but this matches the spec, and works on iOS
This commit is contained in:
parent
6c98bb706a
commit
94ffb50e04
@ -40,7 +40,7 @@ exports.getInfoTiddlerFields = function(updateInfoTiddlersCallback) {
|
|||||||
var mqList = window.matchMedia("(prefers-color-scheme: dark)"),
|
var mqList = window.matchMedia("(prefers-color-scheme: dark)"),
|
||||||
getDarkModeTiddler = function() {return {title: "$:/info/darkmode", text: mqList.matches ? "yes" : "no"};};
|
getDarkModeTiddler = function() {return {title: "$:/info/darkmode", text: mqList.matches ? "yes" : "no"};};
|
||||||
infoTiddlerFields.push(getDarkModeTiddler());
|
infoTiddlerFields.push(getDarkModeTiddler());
|
||||||
mqList.addEventListener("change", function(event) {
|
mqList.addListener(function(event) {
|
||||||
updateInfoTiddlersCallback([getDarkModeTiddler()]);
|
updateInfoTiddlersCallback([getDarkModeTiddler()]);
|
||||||
});
|
});
|
||||||
// Language
|
// Language
|
||||||
|
Loading…
Reference in New Issue
Block a user