chore: document formatting rules
This commit is contained in:
33
API.md
33
API.md
@@ -5,9 +5,11 @@
|
||||
### Configuration
|
||||
|
||||
#### `configure(options: ConfigureOptions): Promise<void>`
|
||||
|
||||
Configure the plugin with storage, TTL, and optimization settings.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
- `options.storage`: `'shared'` | `'tiered'` - Storage mode
|
||||
- `options.ttlSeconds`: `number` - TTL in seconds (default: 1800)
|
||||
- `options.prefetchLeadMinutes`: `number` - Prefetch lead time (default: 15)
|
||||
@@ -18,9 +20,11 @@ Configure the plugin with storage, TTL, and optimization settings.
|
||||
### Core Methods
|
||||
|
||||
#### `scheduleDailyNotification(options: NotificationOptions): Promise<void>`
|
||||
|
||||
Schedule a daily notification with content fetching.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
- `options.url`: `string` - Content endpoint URL
|
||||
- `options.time`: `string` - Time in HH:MM format
|
||||
- `options.title`: `string` - Notification title
|
||||
@@ -29,9 +33,11 @@ Schedule a daily notification with content fetching.
|
||||
- `options.retryConfig`: `RetryConfiguration` - Custom retry settings (optional)
|
||||
|
||||
#### `getLastNotification(): Promise<NotificationResponse | null>`
|
||||
|
||||
Get the last scheduled notification.
|
||||
|
||||
#### `cancelAllNotifications(): Promise<void>`
|
||||
|
||||
Cancel all scheduled notifications.
|
||||
|
||||
### Platform-Specific Methods
|
||||
@@ -39,70 +45,89 @@ Cancel all scheduled notifications.
|
||||
#### Android Only
|
||||
|
||||
##### `getExactAlarmStatus(): Promise<ExactAlarmStatus>`
|
||||
|
||||
Get exact alarm permission and capability status.
|
||||
|
||||
##### `requestExactAlarmPermission(): Promise<void>`
|
||||
|
||||
Request exact alarm permission from user.
|
||||
|
||||
##### `openExactAlarmSettings(): Promise<void>`
|
||||
|
||||
Open exact alarm settings in system preferences.
|
||||
|
||||
##### `getRebootRecoveryStatus(): Promise<RecoveryStatus>`
|
||||
|
||||
Get reboot recovery status and statistics.
|
||||
|
||||
### Management Methods
|
||||
|
||||
#### `maintainRollingWindow(): Promise<void>`
|
||||
|
||||
Manually trigger rolling window maintenance.
|
||||
|
||||
#### `getRollingWindowStats(): Promise<RollingWindowStats>`
|
||||
|
||||
Get rolling window statistics and status.
|
||||
|
||||
### Optimization Methods
|
||||
|
||||
#### `optimizeDatabase(): Promise<void>`
|
||||
|
||||
Optimize database performance with indexes and settings.
|
||||
|
||||
#### `optimizeMemory(): Promise<void>`
|
||||
|
||||
Optimize memory usage and perform cleanup.
|
||||
|
||||
#### `optimizeBattery(): Promise<void>`
|
||||
|
||||
Optimize battery usage and background CPU.
|
||||
|
||||
### Metrics and Monitoring
|
||||
|
||||
#### `getPerformanceMetrics(): Promise<PerformanceMetrics>`
|
||||
|
||||
Get comprehensive performance metrics.
|
||||
|
||||
#### `getErrorMetrics(): Promise<ErrorMetrics>`
|
||||
|
||||
Get error handling metrics and statistics.
|
||||
|
||||
#### `getNetworkMetrics(): Promise<NetworkMetrics>`
|
||||
|
||||
Get network efficiency metrics (ETag support).
|
||||
|
||||
#### `getMemoryMetrics(): Promise<MemoryMetrics>`
|
||||
|
||||
Get memory usage metrics and statistics.
|
||||
|
||||
#### `getObjectPoolMetrics(): Promise<ObjectPoolMetrics>`
|
||||
|
||||
Get object pooling efficiency metrics.
|
||||
|
||||
### Utility Methods
|
||||
|
||||
#### `resetPerformanceMetrics(): Promise<void>`
|
||||
|
||||
Reset all performance metrics to zero.
|
||||
|
||||
#### `resetErrorMetrics(): Promise<void>`
|
||||
|
||||
Reset error handling metrics.
|
||||
|
||||
#### `clearRetryStates(): Promise<void>`
|
||||
|
||||
Clear all retry states and operations.
|
||||
|
||||
#### `cleanExpiredETags(): Promise<void>`
|
||||
|
||||
Clean expired ETag cache entries.
|
||||
|
||||
## Data Types
|
||||
|
||||
### ConfigureOptions
|
||||
|
||||
```typescript
|
||||
interface ConfigureOptions {
|
||||
storage?: 'shared' | 'tiered';
|
||||
@@ -123,6 +148,7 @@ interface ConfigureOptions {
|
||||
```
|
||||
|
||||
### NotificationOptions
|
||||
|
||||
```typescript
|
||||
interface NotificationOptions {
|
||||
url: string;
|
||||
@@ -135,6 +161,7 @@ interface NotificationOptions {
|
||||
```
|
||||
|
||||
### ExactAlarmStatus (Android)
|
||||
|
||||
```typescript
|
||||
interface ExactAlarmStatus {
|
||||
supported: boolean;
|
||||
@@ -145,6 +172,7 @@ interface ExactAlarmStatus {
|
||||
```
|
||||
|
||||
### PerformanceMetrics
|
||||
|
||||
```typescript
|
||||
interface PerformanceMetrics {
|
||||
overallScore: number;
|
||||
@@ -162,6 +190,7 @@ interface PerformanceMetrics {
|
||||
```
|
||||
|
||||
### ErrorMetrics
|
||||
|
||||
```typescript
|
||||
interface ErrorMetrics {
|
||||
totalErrors: number;
|
||||
@@ -181,6 +210,7 @@ interface ErrorMetrics {
|
||||
All methods return promises that reject with descriptive error messages. The plugin includes comprehensive error categorization and retry logic.
|
||||
|
||||
### Common Error Types
|
||||
|
||||
- **Network Errors**: Connection timeouts, DNS failures
|
||||
- **Storage Errors**: Database corruption, disk full
|
||||
- **Permission Errors**: Missing exact alarm permission
|
||||
@@ -190,18 +220,21 @@ All methods return promises that reject with descriptive error messages. The plu
|
||||
## Platform Differences
|
||||
|
||||
### Android
|
||||
|
||||
- Requires `SCHEDULE_EXACT_ALARM` permission for precise timing
|
||||
- Falls back to windowed alarms (±10m) if exact permission denied
|
||||
- Supports reboot recovery with broadcast receivers
|
||||
- Full performance optimization features
|
||||
|
||||
### iOS
|
||||
|
||||
- Uses `BGTaskScheduler` for background prefetch
|
||||
- Limited to 64 pending notifications
|
||||
- Automatic background task management
|
||||
- Battery optimization built-in
|
||||
|
||||
### Web
|
||||
|
||||
- Placeholder implementations for development
|
||||
- No actual notification scheduling
|
||||
- All methods return mock data
|
||||
|
||||
Reference in New Issue
Block a user