كيف أجد كل onAppEvents؟ هل هناك أي حدث لتبديل نظام الألوان؟

In the JS API there is onAppEvent allowing to listen for an event. But how can I find the list of these events? I tried searching for onAppEvent and .trigger(, but have not found much.

Right now I am looking for an event triggering on the automatic color scheme switching (Automatic Dark Mode color scheme switching). Does such event exist?

إعجابَين (2)

You need to look for this.appEvents.trigger and this.appEvents.on
This object accessible from a handful of ember objects.

3 إعجابات

This specific event is handled by the browser, Discourse doesn’t have its own event here. But you can have a JS listener for the prefers-color-scheme media query. See How to detect dark mode using JavaScript (or search Google for other examples).

إعجابَين (2)