Skip to content

The halone client ​

ts
import { useHalone } from '@halone/sdk'

const halone = useHalone()

useHalone() returns one client per page. Every method returns a promise, and rejects with a HaloneError on failure. This page lists what a third-party app can call, and the permission each call needs; the generated reference has every type.

Members ​

Member
readyResolves once the shell has connected.
connectionThe underlying Connection, as a promise.
on(name, listener)Subscribes to an event; returns a function that unsubscribes.

Methods for apps ​

MethodPermissionAnswers with
system.info()SystemInfo: platform (simulator or android), Halone's version, protocol version, the glasses' name, field of view and resolution
system.ping()The round trip to the shell, in milliseconds
system.battery()Battery: level from 0 to 1, charging
display.state()DisplayState: whether the environment runs, in 3D or 2D, at what refresh rate
windows.self()WindowInfo of the caller
windows.setTitle(title)
windows.resize(widthPx, heightPx, anchor?)The size it got
windows.setSizeLimits(limits | null)
windows.setStereoRegion(region | null)
windows.setAutoHide(enabled)
windows.setPinned(pinned)Own window only
windows.close()Own window only
windows.openedFile(){ path }: the file the window was last asked to open
windows.route(){ route }: where apps.launch last asked the window to go
windows.openUrl(url)WindowInfo
windows.list()windowsEvery WindowInfo
windows.focus(id)windows
browser.open(url, private?)The web window's WindowInfo
menu.show(items, xPx, yPx)The chosen item's id, or null
clipboard.writeText(text)
clipboard.read()clipboardClipboardContent
clipboard.writeFiles({ paths, cut })files
files.access()files{ granted }
files.roots()filesFileRoot[]
files.list(path)filesFileEntry[]
files.stat(path)filesFileEntry
files.copy(paths, to)filesThe new entries
files.move(paths, to)filesThe new entries
files.rename(path, name)filesThe new entry
files.delete(paths)files
files.createDirectory(parent, name)filesThe new entry
apps.open(path, appId?)filesThe window it opened in
apps.list(includeHidden?)appsAppInfo[]
apps.launch(appId, route?)appsThe app's window
media.open(path, layout, startSeconds?)filesMediaState
media.state()MediaState
media.play(), pause(), seek(seconds)
media.setLayout(layout), recenter(), setRotatable(rotatable), close()
sockets.connect(host, port, options?)network.tcpA TcpSocket
screen.capture(delayMs?)screenSaves what the left eye sees to the gallery
screen.recording()screenRecordingState
screen.startRecording(delayMs?), stopRecording()screen
scene.recenter()
scene.headPose()sensorsHeadPose

The client also has browser (tabs and navigation), history, bookmarks, downloads, launcher, plugins, status, input, settings, apps.uninstall, files.requestAccess, display.restart, system.shareLog and the menu overlay's menu.current, rendered and choose. Those are for Halone's own apps, and fail with permission-denied in any other.

Events for apps ​

EventPermissionData
window.focusChanged{ focused }
window.fileOpened{ path }
window.routed{ route }
system.batteryChangedBattery
display.changedDisplayState
media.changedMediaState, to the window that owns the player
socket.data, socket.closedHandled by TcpSocket
windows.changedwindowsWindowInfo[]
apps.changedappsnull; call apps.list()
files.accessChangedfiles{ granted }
screen.recordingChangedscreenRecordingState

Other exports ​

Export
connect, createClientWhat useHalone() is built from; see How the bridge works.
HaloneErrorThe error every call rejects with; has a code.
TcpSocketA TCP connection; see TCP sockets.
parentPath, baseName, mimeTypeOf, mimeMatches, isImage, isVideoPath and type helpers; see Files.
layoutFromName, eyeAspect, fitBox, splitMpoStereo helpers; see Stereo and 360° video and Stereo pictures.
Methods, EventsThe protocol: every method's parameters and result, and every event's data.
PackageManifest, Permissionhalone.json and its permissions.
@halone/sdk/packagecheckManifest, for tooling; see The manifest.

Released under the MIT License.