Skip to content

Commit

Permalink
docs: fixed few things on the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
khawarizmus committed Oct 3, 2023
1 parent b76a9d4 commit 0f6c90c
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function sidebarGuide() {
collapsible: true,
items: [
{ text: 'Config Reference', link: '/config/index' },
{ text: 'Methods', link: '/config/methods' },
{ text: 'Calculation Methods', link: '/config/methods' },
],
},
{
Expand Down
114 changes: 113 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,115 @@
# API Reference

WIP
## Table of Contents

- [StaticCalculator](#StaticCalculator)
- [Constructor](#StaticCalculator-Constructor)
- [Methods](#StaticCalculator-Methods)
- [ReactiveCalculator](#ReactiveCalculator)
- [Constructor](#ReactiveCalculator-Constructor)
- [Methods](#ReactiveCalculator-Methods)
- [Helper Functions](#Helper-Functions)
- [calculateQibla](#calculateQibla)
- [Types](#Types)
- [CoordinatesObject](#CoordinatesObject)
- [TimeObject](#TimeObject)

---

## StaticCalculator

### Constructor

#### `new StaticCalculator(config: CalculationsConfig)`

Initializes a new `StaticCalculator` instance.

**Parameters:**

- `config`: [CalculationsConfig](#CalculationsConfig)

**Example:**

```ts
const calculator = new StaticCalculator({
/* config options */
})
```

### Methods

#### `getQiblaDirection(coordinates?: CoordinatesObject): number`

Calculates the Qibla direction.

**Parameters:**

- `coordinates`: Optional. [CoordinatesObject](#CoordinatesObject)

**Example:**

```ts
const direction = calculator.getQiblaDirection()
```

---

## ReactiveCalculator

### Constructor

#### `new ReactiveCalculator(config: CalculationsConfig)`

Initializes a new `ReactiveCalculator` instance.

### Methods

#### `cleanup(): void`

Cleans up all subscriptions.

**Example:**

```ts
reactiveCalculator.cleanup()
```

---

## Helper Functions

### calculateQibla

#### `calculateQibla(coordinates: CoordinatesObject): number`

Calculates the Qibla direction based on the given coordinates.

**Example:**

```ts
const direction = calculateQibla({ latitude: 40.7128, longitude: -74.006 })
```

---

## Types

### CoordinatesObject

```ts
{
latitude: number
longitude: number
}
```

### TimeObject

```ts
{
name: string
time: Date
}
```

---
10 changes: 8 additions & 2 deletions docs/recipes/testing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Testing

::: tip
This is a work in progress. If you have any questions or suggestions, please [open an issue]() or [start a discussion]().
::: warning Work in progress
We're currently evaluating the inclusion of testing utilities. While they may not be available in version 1, we're considering adding them in future releases. Your input is valuable to us. Feel free to open an [issue]() for questions or suggestions.
:::

Testing reactive code can be tricky. That's why `prayer-call` provides some helpers that allows you to test your reactive code in a synchronous manner.

<!--
Testing your code
how to use timers to go to the past or the future
how to use marble tests to test the expected outputs
-->
4 changes: 3 additions & 1 deletion docs/roadmap.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
- Offer open source tools to make comparing and making methods easier.
- Offer open source tools to make comparing and building calculation methods easier.
- Re-write the library from scratch making it reactive from the ground up (using vue 3 reactive core api)
- improve the docs to have examples imported from actual ts files <!-- https://vitepress.dev/guide/markdown#import-code-snippets -->
- translated the docs to Arabic
- Add altitude to the calculation formula
- Support `Temporal` instead of `Date`
- Offer testing utilities for reactive code

0 comments on commit 0f6c90c

Please sign in to comment.