1.0.12 • Published 11 months ago

@smiilliin/settings v1.0.12

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

Settings - Easier to load and write settings

Usage

Initialization

Initialize setting class

import SettingManager from "@smiilliin/settings";

const settingManager = new SettingManager("test-app");

Set

Set setting file

settingManager.set("settings.json", {
  test: "hello world",
});

Set option

settingManager.setOption("settings.json", "test", "hello world");

Delete

Delete file

settingManager.delete("settings.json");

Delete option

settingManager.deleteOption("settings.json", "test");

Load

Create app directory and load setting

console.log(settingManager.load("settings.json"));

With default settings

console.log(settingManager.load("settings.json", { test2: "hi" }));

Watch

Watch setting file

settingManager.watch("setting.json", (setting) => {
  console.log(setting);
});

With default settings

settingManager.watch(
  (setting) => {
    console.log(setting);
  },
  { test: "hello world" }
);

Unwatch

Release watch

settingManager.unwatch("setting.json");

Release all watch

settingManager.unwatchAll();

CreateDir

Create app directory(not neccessary if already loaded setting)

settingManager.createDir();

GetAppdir

Get app directory

console.log(settingManager.getAppdir());
1.0.12

11 months ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago