(options?: SpendControlOptions)
| 164 | private readonly now: () => number; |
| 165 | |
| 166 | constructor(options?: SpendControlOptions) { |
| 167 | this.storage = options?.storage ?? new FileSpendControlStorage(); |
| 168 | this.now = options?.now ?? (() => Date.now()); |
| 169 | this.load(); |
| 170 | } |
| 171 | |
| 172 | setLimit(window: SpendWindow, amount: number): void { |
| 173 | if (!Number.isFinite(amount) || amount <= 0) { |