Skip to content

Commit

Permalink
fix: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan-TheGentleman committed May 3, 2024
1 parent 23df627 commit 873b6eb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 58 deletions.
76 changes: 19 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,63 +14,7 @@ To use the Signals Manager in your project, follow these steps:
2. Install the required dependencies.
3. Import the necessary modules into your project.

## Usage

### `SignalsManager` Class

The `SignalsManager` class provides methods for creating, retrieving, and updating signals. Here's how you can use it:

```typescript
import { SignalsManager } from "./signals_manager";

// Define your default state
const defaultState = {
// Define your state properties here with their default values
count: 0,
};

// Initialize the Signals Manager
const signalsManager = new SignalsManager(defaultState);

// Now you can add, retrieve, and update signals as needed
// But !! only the signals declared at the "defaultState" object, if you try to use any key that is not already provided an error will occur by typescript
```

### Initialization

You can initialize the Signals Manager using the `initSignalsManager` function:

```typescript
import { initSignalsManager } from "./init";

// Define your default state
const defaultState = {
// Define your state properties here
};

// Initialize the Signals Manager
const signalsManager = initSignalsManager(defaultState);

// Now you can start using the Signals Manager
```

### Retrieving a Signal

To retrieve a signal from the manager, use the `getSignal` method:

```typescript
const mySignal = signalsManager.getSignal("propertyName");
```

### Updating a Signal

To update a signal in the manager, use the `updateSignal` method:

```typescript
signalsManager.updateSignal("propertyName", payload);
```

### How to implement
## How to implement

```typescript
import { initSignalsManager, SignalsState } from "gentleman-agnostic-signals";
Expand Down Expand Up @@ -100,6 +44,24 @@ const signalsManager = initSignalsManager(defaultState);
// But !! only the signals declared at the "defaultState" object, if you try to use any key that is not already provided an error will occur by typescript
```

## Usage

### Retrieving a Signal

To retrieve a signal from the manager, use the `getSignal` method:

```typescript
const mySignal = signalsManager.getSignal("propertyName");
```

### Updating a Signal

To update a signal in the manager, use the `updateSignal` method:

```typescript
signalsManager.updateSignal("propertyName", payload);
```

## Conclusion

And that's it! You're now ready to start using the Signals Manager in your project. If you have any questions or need further assistance, feel free to reach out. Happy coding! 🚀🔔
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gentleman-agnostic-signals",
"version": "0.0.1",
"version": "0.0.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"description": "",
Expand Down

0 comments on commit 873b6eb

Please sign in to comment.