Skip to content
Playground llms.txt
Docs in progress TKO docs are in progress. Examples, API details, and migration notes are still being revised.

API Reference

Quick-lookup table for TKO’s public API. Each entry links to its detailed documentation.

FunctionDescription
ko.observable(value?)Create a reactive value. Docs
ko.observableArray(array?)Observable wrapper around an array with mutation methods. Docs
ko.isObservable(value)Check if a value is an observable. Docs
ko.isObservableArray(value)Check if a value is an observable array. Docs
ko.isWritableObservable(value)Check if a value is a writable observable. Docs
ko.isSubscribable(value)Check if a value is any subscribable type. Docs
ko.peek(value)Read an observable’s value without creating a dependency.
ko.unwrap(value)Read an observable’s value, or return a plain value as-is. Docs
ko.toJS(object)Clone an object tree, replacing observables with their values. Docs
ko.toJSON(object, replacer?, space?)ko.toJS + JSON.stringify. Docs
FunctionDescription
ko.computed(evaluatorOrOptions, owner?, options?)Create a value that depends on other observables. Accepts a function or { read, write } options object. Docs
ko.pureComputed(evaluator, owner?)Computed that sleeps when it has no subscribers. Docs
ko.isComputed(value)Check if a value is a computed observable. Docs
ko.isPureComputed(value)Check if a value is a pure computed.
ko.ignoreDependencies(callback, owner?, args?)Run a function without tracking dependencies.
ko.when(predicate, callback?, context?)Resolve when the predicate becomes truthy. Returns a promise, or calls callback if provided. Docs

Every observable, computed, and observable array inherits these from subscribable.fn:

MethodDescription
.subscribe(callback, target?, event?)Register a callback for changes. Docs
.when(testOrValue, returnValue?)Promise that resolves when the test passes. Docs
.yet(testOrValue, returnValue?)Promise that resolves when the test fails (negated .when). Docs
.next()Promise that resolves on the next value change. Docs
.once(callback)Call the callback on the next change, then auto-dispose. Docs
.peek()Read the current value without creating a dependency.
.dispose()Tear down all subscriptions.
FunctionDescription
observable.extend(extenders)Apply extenders to an observable or computed. Docs
rateLimitThrottle change notifications. Docs
notify: 'always'Force notification even when value hasn’t changed. Docs
FunctionDescription
ko.applyBindings(viewModel, rootNode?)Activate bindings on a DOM subtree. Docs
ko.applyBindingsToNode(node, bindings, viewModelOrContext?)Apply bindings to a single node programmatically.
ko.applyBindingsToDescendants(viewModelOrContext, rootNode)Apply bindings to descendants only (used in custom bindings). Docs
ko.contextFor(node)Get the binding context for a DOM node.
ko.dataFor(node)Get the view model bound to a DOM node.
ko.cleanNode(node)Remove all TKO data and bindings from a node.
ko.bindingHandlersRegistry of built-in and custom binding handlers. Docs
ko.bindingEventBinding lifecycle event constants (e.g., childrenComplete, descendantsComplete).
ko.BindingHandlerBase class for class-based custom binding handlers. Docs
ko.AsyncBindingHandlerAsync variant of BindingHandler for bindings that load resources. Docs

Text & HTML: text, html, textInput, value

Appearance: visible, hidden, css (alias: class), style, attr

Control flow: if, ifnot (alias: unless), else, elseif, foreach (alias: each), with, template

Context: let, using

Form: click, event (alias: on), submit, enable, disable, checked, checkedValue, options, selectedOptions, hasfocus, uniqueName

Components: component, slot

Lifecycle: descendantsComplete

FunctionDescription
ko.components.register(name, config)Register a component. Docs
ko.components.get(name)Retrieve a registered component definition. Docs
ko.components.isRegistered(name)Check if a component name is registered.
ko.components.unregister(name)Remove a component registration.
ko.components.clearCachedDefinition(name)Clear a cached component definition.
ko.ComponentBase class for class-based components (ComponentABC). Docs
FunctionDescription
ko.jsx.createElement(tag, props, ...children)Create a JSX element. Used as the JSX factory.
ko.jsx.FragmentFragment component for grouping elements without a wrapper node.
ko.jsx.render(jsx)Render JSX to DOM nodes. Returns { node, dispose }.
FunctionDescription
ko.domNodeDisposal.addDisposeCallback(node, callback)Run a callback when a DOM node is removed by TKO.
ko.domNodeDisposal.removeDisposeCallback(node, callback)Remove a previously registered disposal callback.
FunctionDescription
ko.subscribable.fnPrototype for all subscribables. Docs
ko.observable.fnPrototype for all observables — add methods here. Docs
ko.observableArray.fnPrototype for observable arrays (remove, replace, etc.). Docs
ko.computed.fnPrototype for all computeds. Docs
ko.tasksMicrotask scheduler for batching async work.