Skip to content

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 ​

On-Demand
ts
import { open } from 'protocol-launcher/pcalc'

const url = open()

Set Value ​

On-Demand
ts
import { setValue } from 'protocol-launcher/pcalc'

const url = setValue({
  value: 12345,
})

Convert Value ​

On-Demand
ts
import { convertValue } from 'protocol-launcher/pcalc'

const url = convertValue({
  value: 12345,
})

Open Constants ​

On-Demand
ts
import { openConstants } from 'protocol-launcher/pcalc'

const url = openConstants()

Open Tape ​

On-Demand
ts
import { openTape } from 'protocol-launcher/pcalc'

const url = openTape()

Open Registers ​

On-Demand
ts
import { openRegisters } from 'protocol-launcher/pcalc'

const url = openRegisters()

Open Stack ​

On-Demand
ts
import { openStack } from 'protocol-launcher/pcalc'

const url = openStack()

Open Settings ​

On-Demand
ts
import { openSettings } from 'protocol-launcher/pcalc'

const url = openSettings()

Clear All ​

On-Demand
ts
import { clearAll } from 'protocol-launcher/pcalc'

const url = clearAll()

Open Layout ​

On-Demand
ts
import { openLayout } from 'protocol-launcher/pcalc'

const url = openLayout({
  name: 'Engineering',
})

Open Calculator ​

On-Demand
ts
import { openCalculator } from 'protocol-launcher/pcalc'

const url = openCalculator({
  name: 'name',
})

X-Callback Set ​

On-Demand
ts
import { xCallbackSet } from 'protocol-launcher/pcalc'

const url = xCallbackSet()

X-Callback Error ​

On-Demand
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'

Official Documentation ​