1
0
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:
jeremy@jermolene.com 2020-11-25 12:33:39 +00:00
parent 6c98bb706a
commit 94ffb50e04

View File

@ -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