docs: update README for default demo and command aliases
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
# RPN Virtual Calculator
|
||||
|
||||
A browser-friendly RPN calculator built around a small, generic JavaScript API.
|
||||
A browser-friendly RPN calculator built around a small JavaScript API.
|
||||
|
||||
## Overview
|
||||
|
||||
This project provides:
|
||||
|
||||
- a reusable JavaScript RPN engine in `src/rpn-calculator.js`
|
||||
- browser demos in `samples/dev/` and `samples/calc-02/`
|
||||
- a command system centralized in a single operation dictionary
|
||||
- a small public API focused on stack operations and generic command dispatch
|
||||
- a classic browser demo in `samples/dev/`
|
||||
- a portrait-first HP48GX-inspired demo in `samples/calc-02/`
|
||||
- a centralized command system with aliases
|
||||
- a compact public API focused on stack operations, editing, and command dispatch
|
||||
|
||||
The main class is `RpnCalculator`.
|
||||
|
||||
@@ -19,9 +20,6 @@ The main class is `RpnCalculator`.
|
||||
- `samples/dev/index.html`: browser demo entry point
|
||||
- `samples/dev/index.css`: demo styles
|
||||
- `samples/dev/index.js`: demo UI and keyboard logic
|
||||
- `samples/calc-01/index.html`: active browser demo entry point
|
||||
- `samples/calc-01/index.css`: demo styles
|
||||
- `samples/calc-01/index.js`: demo UI and keyboard logic
|
||||
- `samples/calc-02/index.html`: portrait-first HP48GX-style demo entry point
|
||||
- `samples/calc-02/index.css`: portrait-first demo styles
|
||||
- `samples/calc-02/index.js`: portrait-first HP48GX-style demo UI and keyboard logic
|
||||
@@ -68,10 +66,10 @@ State exposed on instances:
|
||||
|
||||
```js README.md
|
||||
const calc = new RpnCalculator({
|
||||
maxSize: 2048,
|
||||
base: 10,
|
||||
angleMode: 'deg',
|
||||
enabledCommands: ['add', 'sub', 'mul', 'div']
|
||||
maxSize: 2048,
|
||||
base: 10,
|
||||
angleMode: 'deg',
|
||||
enabledCommands: ['add', 'sub', 'mul', 'div']
|
||||
});
|
||||
```
|
||||
|
||||
@@ -88,6 +86,9 @@ Available constants:
|
||||
|
||||
- `pi`
|
||||
- `e`
|
||||
- `phi`
|
||||
- `g`
|
||||
- `c`
|
||||
- plus any user-defined constants added through the engine API
|
||||
|
||||
They can be used through `command(...)`:
|
||||
@@ -194,10 +195,10 @@ console.log(calc.pop()); // 5
|
||||
```html README.md
|
||||
<script src="./src/rpn-calculator.js"></script>
|
||||
<script>
|
||||
const calc = new RpnCalculator({ angleMode: 'deg' });
|
||||
calc.push(9);
|
||||
calc.command('sqrt');
|
||||
console.log(calc.pop());
|
||||
const calc = new RpnCalculator({ angleMode: 'deg' });
|
||||
calc.push(9);
|
||||
calc.command('sqrt');
|
||||
console.log(calc.pop());
|
||||
</script>
|
||||
```
|
||||
|
||||
@@ -239,7 +240,7 @@ console.log(calc.pop()); // 0.5
|
||||
|
||||
## Demo
|
||||
|
||||
The active demo lives in `samples/dev/`.
|
||||
The default demo lives in `samples/dev/`.
|
||||
|
||||
Main UI features:
|
||||
|
||||
@@ -249,7 +250,7 @@ Main UI features:
|
||||
- angle mode selector for `deg`, `rad`, and `grad`
|
||||
- status pills for `inputValue` and `isEditing`
|
||||
- grouped panels for `Stack`, `Arithmetic`, `Trigonometry`, and `Constants`
|
||||
- error display area
|
||||
- keyboard-friendly hidden input on desktop
|
||||
|
||||
## Calc 02 demo
|
||||
|
||||
|
||||
Reference in New Issue
Block a user