FuseJS/DarkMode Module (JS)
This page contains documentation for advanced Fuse features, so we have
taken the liberty to tick the "Show advanced things" checkbox above for
you in advance to be able to provide you with some additional information.
This module provides access to whether or not the current OS setting for Dark Mode is enabled and or changed.
Example
<App>
<JavaScript>
var DarkMode = require("FuseJS/DarkMode");
var Observable = require("FuseJS/Observable");
var isDarkMode = Observable(false);
DarkMode.on("changed", function(val) {
console.log("DARKMODE CHANGED: " + val);
switch(val) {
case 'light': isDarkMode.value = false;
break;
case 'dark': isDarkMode.value = true;
break;
}
});
module.exports = {
isDarkMode
}
</JavaScript>
<StackPanel Alignment="Center">
<Text ux:Name="title" Value="Hello World!" />
</StackPanel>
<Rectangle ux:Name="bk" Layer="Background" Color="#FFF" />
<WhileTrue Value="{isDarkMode}">
<Change title.Value="Hello Dark World!" />
<Change title.Color="#FFF" />
<Change bk.Color="#000" />
</WhileTrue>
<WhileFalse Value="{isDarkMode}">
<Change title.Value="Hello World!" />
<Change title.Color="#000" />
<Change bk.Color="#FFF" />
</WhileFalse>
</App>
Location
- Namespace
- Fuse.Controls.Native.iOS
- Package
- Fuse.Controls.Native 2.9.1
Interface of DarkMode
receivedDarkModeChangedEvent(string) uno
Inherited from NativeEventEmitterModule
Emit(object[]) uno
EmitError(string) uno
Call emit("error", reason)
on the underlying JS EventEmitter.
EmitErrorObject(string) uno
Call emit("error", new Error(reason))
on the underlying JS EventEmitter.
EmitFactory(Func<Context, object[]> (Context)) uno
EmitFactory<T>(Func<Context, T, object[]> (Context, T), T) uno
On(object, Callback (Context, object[])) uno
Connect a Callback to an event.
On(object, NativeEvent) uno
Inherited from NativeModule
AddMember(NativeMember) uno
Reset : EventHandler (object, EventArgs) ux
Inherited from Module
Dispose uno
Evaluate(Context, ModuleResult) uno
Evaluate(Context, string) : ModuleResult uno
Evaluated : EventHandler (object, EventArgs) ux
EvaluateExports(Context, string) : object uno
GetFile : FileSource uno
Returns the file source that will be watched by the Context for changes in Fuse preview. Override in subclasses and return correct file source to support live updates in Fuse preview.