From f2729e287a21a51c920ee91427294f9e3b7a473a Mon Sep 17 00:00:00 2001 From: ztimson Date: Wed, 20 Dec 2023 00:33:13 -0500 Subject: [PATCH] removed old docs --- docs/.nojekyll | 1 - docs/Home.md | 102 ------------- docs/classes/Persist.md | 308 ---------------------------------------- 3 files changed, 411 deletions(-) delete mode 100644 docs/.nojekyll delete mode 100644 docs/Home.md delete mode 100644 docs/classes/Persist.md diff --git a/docs/.nojekyll b/docs/.nojekyll deleted file mode 100644 index e2ac661..0000000 --- a/docs/.nojekyll +++ /dev/null @@ -1 +0,0 @@ -TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/Home.md b/docs/Home.md deleted file mode 100644 index f05ebc9..0000000 --- a/docs/Home.md +++ /dev/null @@ -1,102 +0,0 @@ -persist - -# persist - -## Table of contents - -### Classes - -- [Persist](classes/Persist.md) - -### Decorators - -- [persist](Home.md#persist) - -### Options - -- [PersistOptions](Home.md#persistoptions) - -## Decorators - -### persist - -▸ **persist**\<`T`\>(`options?`): (`target`: `any`, `prop`: `any`) => `void` - -Sync class property with persistent storage (LocalStorage by default) - -#### Type parameters - -| Name | -| :------ | -| `T` | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `options?` | [`PersistOptions`](Home.md#persistoptions)\<`T`\> & \{ `key?`: `string` } | Configure using [PersistOptions](Home.md#persistoptions) | - -#### Returns - -`fn` - -Decorator function - -▸ (`target`, `prop`): `void` - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `target` | `any` | -| `prop` | `any` | - -##### Returns - -`void` - -**`Example`** - -```ts -class ThemeEngine { - @persist({default: 'os'}) current!: string; -} - -const theme = new ThemeEngine(); -console.log(theme.current) // Output: os - -theme.current = 'light'; //Any changes will be automatically saved to localStorage - -location.reload(); // Simulate refresh -console.log(theme.current) // Output: light -``` - -#### Defined in - -persist.ts:135 - -## Options - -### PersistOptions - -Ƭ **PersistOptions**\<`T`\>: `Object` - -Configurations persistence behaviour - -#### Type parameters - -| Name | -| :------ | -| `T` | - -#### Type declaration - -| Name | Type | Description | -| :------ | :------ | :------ | -| `default?` | `T` | Default/Initial value if undefined | -| `storage?` | `Storage` | Storage implementation, defaults to LocalStorage | -| `type?` | `any` | Force value to have prototype | - -#### Defined in - -persist.ts:6 diff --git a/docs/classes/Persist.md b/docs/classes/Persist.md deleted file mode 100644 index e0e5ef2..0000000 --- a/docs/classes/Persist.md +++ /dev/null @@ -1,308 +0,0 @@ -[persist](../Home.md) / Persist - -# Class: Persist\ - -Sync variable's value with persistent storage (LocalStorage by default) - -**`Example`** - -```ts -const theme = new Persist('theme.current', {default: 'os'}); -console.log(theme.value); // Output: os - -theme.value = 'light'; // Any changes to `.value` will automatically sync with localStorage - -location.reload(); // Simulate refresh -console.log(theme.value); // Output: light -``` - -## Type parameters - -| Name | -| :------ | -| `T` | - -## Table of contents - -### Constructors - -- [constructor](Persist.md#constructor) - -### Properties - -- [\_value](Persist.md#_value) -- [key](Persist.md#key) -- [options](Persist.md#options) -- [storage](Persist.md#storage) -- [watches](Persist.md#watches) - -### Accessors - -- [value](Persist.md#value) - -### Methods - -- [clear](Persist.md#clear) -- [load](Persist.md#load) -- [notify](Persist.md#notify) -- [save](Persist.md#save) -- [toString](Persist.md#tostring) -- [valueOf](Persist.md#valueof) -- [watch](Persist.md#watch) - -## Constructors - -### constructor - -• **new Persist**\<`T`\>(`key`, `options?`): [`Persist`](Persist.md)\<`T`\> - -#### Type parameters - -| Name | -| :------ | -| `T` | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `key` | `string` | Unique key value will be stored under | -| `options` | [`PersistOptions`](../Home.md#persistoptions)\<`T`\> | Configure using [PersistOptions](../Home.md#persistoptions) | - -#### Returns - -[`Persist`](Persist.md)\<`T`\> - -#### Defined in - -persist.ts:68 - -## Properties - -### \_value - -• `Private` **\_value**: `T` - -Private value field - -#### Defined in - -persist.ts:31 - -___ - -### key - -• `Readonly` **key**: `string` - -Unique key value will be stored under - -#### Defined in - -persist.ts:68 - -___ - -### options - -• **options**: [`PersistOptions`](../Home.md#persistoptions)\<`T`\> = `{}` - -Configure using [PersistOptions](../Home.md#persistoptions) - -#### Defined in - -persist.ts:68 - -___ - -### storage - -• `Private` `Readonly` **storage**: `Storage` - -Where data gets physically stored - -#### Defined in - -persist.ts:60 - -___ - -### watches - -• `Private` **watches**: `Object` = `{}` - -Listeners which should be notified on changes - -#### Index signature - -▪ [key: `string`]: `Function` - -#### Defined in - -persist.ts:62 - -## Accessors - -### value - -• `get` **value**(): `T` - -Current value or default if undefined - -#### Returns - -`T` - -#### Defined in - -persist.ts:34 - -• `set` **value**(`v`): `void` - -Set value with proxy object wrapper to sync future changes - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `v` | `undefined` \| `T` | - -#### Returns - -`void` - -#### Defined in - -persist.ts:37 - -## Methods - -### clear - -▸ **clear**(): `void` - -Delete value from storage - -#### Returns - -`void` - -#### Defined in - -persist.ts:74 - -___ - -### load - -▸ **load**(): `void` - -Load value from storage - -#### Returns - -`void` - -#### Defined in - -persist.ts:86 - -___ - -### notify - -▸ **notify**(`value`): `void` - -Notify listeners of change - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `value` | `T` | - -#### Returns - -`void` - -#### Defined in - -persist.ts:108 - -___ - -### save - -▸ **save**(): `void` - -Save current value to storage - -#### Returns - -`void` - -#### Defined in - -persist.ts:79 - -___ - -### toString - -▸ **toString**(): `string` - -Return value as JSON string - -#### Returns - -`string` - -#### Defined in - -persist.ts:102 - -___ - -### valueOf - -▸ **valueOf**(): `undefined` \| `Object` - -Return raw value - -#### Returns - -`undefined` \| `Object` - -#### Defined in - -persist.ts:105 - -___ - -### watch - -▸ **watch**(`fn`): () => `void` - -Callback to listen for changes - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `fn` | (`value`: `T`) => `any` | - -#### Returns - -`fn` - -▸ (): `void` - -Callback to listen for changes - -##### Returns - -`void` - -#### Defined in - -persist.ts:95