From 87a690147715a24505244f34962caeda0cf07618 Mon Sep 17 00:00:00 2001 From: Novak Zaballa <41410593+novakzaballa@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:19:58 -0400 Subject: [PATCH] docs: OfflineMode for .Net and NodeJS (#3697) Co-authored-by: Ben Rometsch --- docs/docs/clients/server-side.md | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/docs/clients/server-side.md b/docs/docs/clients/server-side.md index 2f05f8125dff..a3c3cac90871 100644 --- a/docs/docs/clients/server-side.md +++ b/docs/docs/clients/server-side.md @@ -806,6 +806,44 @@ public class MyCustomOfflineHandler implements IOfflineHandler: } ``` + + + +```csharp +// Using the built-in local file handler +var localFileHandler = new LocalFileHandler("path_to_environment_file/environment_file.json"); + +var flagsmithClient = new FlagsmithClient( + offlineMode: true, + offlineHandler: localFileHandler +); + +// Defining a custom offline handler +public class MyCustomOfflineHandler: BaseOfflineHandler +{ + public override EnvironmentModel GetEnvironment() + { + return someMethodToGetTheEnvironment(); + } +} +``` + + + + +```javascript +// Using the built-in local file handler +const localFileHandler = new LocalFileHandler("path_to_environment_file/environment_file.json"); +const flagsmith = new Flagsmith({ offlineMode: true, offlineHandler: localFileHandler }); + +// Defining a custom offline handler +class CustomOfflineHandler extends BaseOfflineHandler { + getEnvironment(): EnvironmentModel { + return someMethodToGetTheEnvironment(); + } +} +``` +