PCalc
PCalc is a calculator for iPad, iPhone, Apple Vision Pro, Apple Watch, and Mac. Protocol Launcher allows you to generate official PCalc URL scheme links.
Usage
There are two ways to use this library:
- On-Demand import from subpaths enables tree-shaking and keeps bundles small.
- Full Import from the root package is convenient but includes all app modules.
Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.
Select Installation Method
On-Demand
Recommended. Optimized for production.
Full Import
Convenient. Good for quick scripts.
Because clearAll() clears the current PCalc state and the x-callback helpers are callback targets, those functions are shown as code only.
Open PCalc
ts
import { open } from 'protocol-launcher/pcalc'
const url = open()Set Value
ts
import { setValue } from 'protocol-launcher/pcalc'
const url = setValue({
value: 12345,
})Convert Value
ts
import { convertValue } from 'protocol-launcher/pcalc'
const url = convertValue({
value: 12345,
})Open Constants
ts
import { openConstants } from 'protocol-launcher/pcalc'
const url = openConstants()Open Tape
ts
import { openTape } from 'protocol-launcher/pcalc'
const url = openTape()Open Registers
ts
import { openRegisters } from 'protocol-launcher/pcalc'
const url = openRegisters()Open Stack
ts
import { openStack } from 'protocol-launcher/pcalc'
const url = openStack()Open Settings
ts
import { openSettings } from 'protocol-launcher/pcalc'
const url = openSettings()Clear All
ts
import { clearAll } from 'protocol-launcher/pcalc'
const url = clearAll()Open Layout
ts
import { openLayout } from 'protocol-launcher/pcalc'
const url = openLayout({
name: 'Engineering',
})Open Calculator
ts
import { openCalculator } from 'protocol-launcher/pcalc'
const url = openCalculator({
name: 'name',
})X-Callback Set
ts
import { xCallbackSet } from 'protocol-launcher/pcalc'
const url = xCallbackSet()X-Callback Error
ts
import { xCallbackError } from 'protocol-launcher/pcalc'
const url = xCallbackError()Generated URLs
ts
open()
// => 'pcalc://'
setValue({ value: 12345 })
// => 'pcalc://set/12345'
convertValue({ value: 12345 })
// => 'pcalc://convert/12345'
openConstants()
// => 'pcalc://constants'
openTape()
// => 'pcalc://tape'
openRegisters()
// => 'pcalc://registers'
openStack()
// => 'pcalc://stack'
openSettings()
// => 'pcalc://settings'
clearAll()
// => 'pcalc://ac'
openLayout({ name: 'Engineering' })
// => 'pcalc://layout/Engineering'
openCalculator({ name: 'name' })
// => 'pcalc://calculator/name'
xCallbackSet()
// => 'pcalc://x-callback-url/set'
xCallbackError()
// => 'pcalc://x-callback-url/error'