@web3os-core/kernel

Members

# (constant) broadcast :BroadcastChannel

The primary Broadcast Channel for web3os

Type:
  • BroadcastChannel
Source:

# (constant) createIcon

Create an icon element

Source:

# (constant) events :CustomEvent

The main kernel event bus

Type:
  • CustomEvent
Properties
Name Type Description
dispatch function

Dispatch an event

Properties
Name Type Description
eventName string

The name of the event

detail Object

The event detail payload

on function

Subscribe to event

Properties
Name Type Description
eventName string

The name of the event

callback function

Execute when this event is triggered

off function

Unsubscribe from event

Properties
Name Type Description
eventName string

The name of the event

callback function

Execute when this event is triggered

Source:

# fs :Object

Gives access to the BrowserFS API

Type:
  • Object
Source:

# (constant) i18n :Object

References the initialized i18next instance

Type:
  • Object
Source:

# (constant) icons

References the @iconify/iconify library

Source:

# (constant) intervals :Object

Contains all registered kernel intervals

Type:
  • Object
Source:

# (constant) KernelEvents

The list of kernel events

Source:

# keyboard :SimpleKeyboard

Gives access to the virtual keyboard

This gives us more control and consistency over mobile input

Type:
  • SimpleKeyboard
Source:

# (constant) modules :Object

Contains all registered kernel modules

Type:
  • Object
Source:

# (constant) notify :AwesomeNotifications

Send an awesome-notification

Type:
  • AwesomeNotifications
Source:
To Do:
  • awesome-notifications will likely eventually replace sweetalert

# (constant) utils :Object

Contains miscellaneous utilities

Type:
  • Object
Source:
To Do:
  • Do this better

# (constant) windows :Object

Manages interactions with the windowing system

Type:
  • Object
Properties
Name Type Description
_collection Set

The collection of windows

create function

Create a new window

Properties
Name Type Description
options Object

Options to pass to WinBox

find function

Find a window by ID

Properties
Name Type Description
id string

The ID of the window (usually winbox-#; stored on app.window.id)

Source:

Methods

# analyticsEvent()

Send an analytics event to the analytics endpoint

Source:

# (async) autostart(defaultAutoStartopt)

Execute the /config/autostart.sh script

Parameters:
Name Type Attributes Description
defaultAutoStart string <optional>

Write autostart script with this content if it doesn't exist

Source:

# (async) boot()

Boot the kernel

This kicks off the process of initializing the filesystem, modules, and other components

Source:

Create a special hyperlink introduced in xterm.js v5

Parameters:
Name Type Description
uri String
text String

# deleteKey(namespacenon-null, keynon-null)

Delete the specified key from the kernel memory object

Parameters:
Name Type Description
namespace string

The namespace containing the key

key key

The key to delete

Source:

# deleteNamespace(namespacenon-null)

Delete the specified namespace from the kernel memory object

Parameters:
Name Type Description
namespace namespace

The namespace to delete

Source:

# (async) dialog(options) → {SweetAlertDialog}

Show a SweetAlert dialog

Parameters:
Name Type Description
options Object

SweetAlert2 options

Source:
Returns:
Type
SweetAlertDialog

# dump() → {string}

Dump the kernel memory to a JSON object

Source:
Returns:

dump The memory dump

Type
string

# (async) execute(cmd) → {CommandResult}

Execute a command

Parameters:
Name Type Description
cmd string

The command to execute

Source:
Returns:
Type
CommandResult

# (async) executeScript(path) → {SweetAlertDialog}

Execute a script file

Parameters:
Name Type Description
path string

The path of the script

Source:
Returns:
Type
SweetAlertDialog

# get(namespacenon-null, keynullable)

Get a value from the kernel memory object

Parameters:
Name Type Attributes Description
namespace string

The namespace from which to get the value

key string <nullable>

The key to retrieve, or undefined to get entire namespace

Source:

# (async) importModuleUrl(url) → {Module}

Directly import an ES module from a URL

Parameters:
Name Type Description
url string

The URL of the module to import

Source:
Returns:
Type
Module

# (async) importUMDModule(url) → {Module}

Directly import a UMD module from a URL

Parameters:
Name Type Description
url string

The URL of the module to import

Source:
Returns:
Type
Module

# loadLocalStorage()

Restore the kernel memory from localStorage

Source:

# (async) loadModule(modnon-null, optionsopt)

Load a module into the kernel

Parameters:
Name Type Attributes Description
mod ModInfo

The mod to load

options Object <optional>

Options for loading the module

Source:

# (async) loadPackages()

Load or install the packages defined in /config/packages

Source:

# log(messagenon-null, optionsnullable)

Log a message to the terminal

Parameters:
Name Type Attributes Description
message any

The message or object to log

options Object <nullable>

Logging options

Properties
Name Type Attributes Default Description
console Boolean <optional>
true

Enable logging to both browser console and Terminal

terminal Web3osTerminal <nullable>

The terminal to attach to, or undefined for global Terminal

Source:

# printBootIntro()

Output the boot introduction

Source:

# printSystemInfo()

Output system information

Source:

# (async) registerBuiltinModules()

Load the kernel's core external modules

Source:

# (async) registerKernelBins()

Load the kernel's core internal commands

Source:
To Do:
  • These are here because they're relatively simple, but many of them should be moved to their own respective external modules.

# restore(jsonnon-null)

Restore the kernel memory from a JSON object

Parameters:
Name Type Description
json string

The JSON object generated from dump()

Source:

# set(namespacenon-null, keynon-null, valuenon-null)

Set a value in the kernel memory object

Parameters:
Name Type Description
namespace string

The namespace in which to set the value

key string

The key in which to set the value

value any

The value to set

Source:

# (async) setupFilesystem(initfsUrlopt, mountableFilesystemConfigopt)

Sets up the filesystem

These parameters can also be provided as a query parameter:

https://web3os.sh/?initfsUrl=https://my.place.com/initfs.zip

Bare minimum, temporary, fs: https://web3os.sh/?mountableFilesystemConfig={ "/": { "fs": "InMemory" }, "/bin": { "fs": "InMemory" } }

Parameters:
Name Type Attributes Description
initfsUrl string <optional>

URL to a zipped filesystem snapshot

mountableFilesystemConfig MountableFileSystemOptions <optional>

Filesystem configuration object for BrowserFS

Source:

# (async) showSplash(msg, optionsopt)

Show the boot splash screen

Parameters:
Name Type Attributes Description
msg string

The message to display

options Object <optional>

The splash screen options

Source:
To Do:
  • Make this more customizable

# (async) snackbar(optionsopt)

Show a snackbar notification

Parameters:
Name Type Attributes Description
options Object <optional>

The snackbar options

Deprecated:
  • This can still be useful I think, but it's being deprecated in favor of awesome-notifications. Should this be removed?
Source:

# specialLinkHandler()

Handle special hyperlinks introduced in xterm.js v5

# (async) systemNotify(optionsopt)

Send a browser/platform notification

Parameters:
Name Type Attributes Description
options Object <optional>

The notification options (Notification API)

Source:

# updateLocalStorage()

Write the kernel memory to localStorage

Source:

# (async) wait(ms) → {Module}

Wait for the specified number of milliseconds

Parameters:
Name Type Description
ms number

The number of milliseconds to wait

Source:
Returns:
Type
Module