Chute
Chute is an advanced network toolbox. Protocol Launcher allows you to generate URL scheme links to start, stop, and toggle Chute.
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
Notes
Chute's official manual documents three iOS URL scheme action groups from version 1.0.2: start | connect | on, stop | disconnect | off, and toggle | switch. Protocol Launcher exposes helpers for the first action in each group: start, stop, and toggle.
The only documented option is autoclose=true, which automatically closes Chute after the action completes.
Chute also documents x-callback-url support with the chute scheme and only the start, stop, and toggle actions. Its example uses x-success and x-error, so this module exposes only those callback query parameters.
Start
import { start } from 'protocol-launcher/chute'
const url = start()Start And Auto Close
import { start } from 'protocol-launcher/chute'
const url = start({
autoclose: true,
})Stop
import { stop } from 'protocol-launcher/chute'
const url = stop()Toggle
import { toggle } from 'protocol-launcher/chute'
const url = toggle({
autoclose: true,
})X-Callback Start
import { xCallbackStart } from 'protocol-launcher/chute'
const url = xCallbackStart({
xSuccess: 'sms://',
xError: 'tel://',
})X-Callback Stop
import { xCallbackStop } from 'protocol-launcher/chute'
const url = xCallbackStop({
xSuccess: 'sms://',
xError: 'tel://',
})X-Callback Toggle
import { xCallbackToggle } from 'protocol-launcher/chute'
const url = xCallbackToggle({
xSuccess: 'sms://',
xError: 'tel://',
})Generated URLs
start()
// => 'chute:///start'
start({ autoclose: true })
// => 'chute:///start?autoclose=true'
stop()
// => 'chute:///stop'
stop({ autoclose: true })
// => 'chute:///stop?autoclose=true'
toggle({ autoclose: true })
// => 'chute:///toggle?autoclose=true'
xCallbackStart({
xSuccess: 'sms://',
xError: 'tel://',
})
// => 'chute://x-callback-url/start?x-success=sms%3A%2F%2F&x-error=tel%3A%2F%2F'
xCallbackStop()
// => 'chute://x-callback-url/stop'
xCallbackToggle()
// => 'chute://x-callback-url/toggle'