Skip to content

Window

Unofficial

Augments the built-in Window interface.

Signature:

export interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandlers, WindowEventHandlers, WindowLocalStorage, WindowOrWorkerGlobalScope, WindowSessionStorage

Extends: EventTarget, AnimationFrameProvider, GlobalEventHandlers, WindowEventHandlers, WindowLocalStorage, WindowOrWorkerGlobalScope, WindowSessionStorage

Properties

PropertyTypeDescription
activeDocumentDocumentThe actively focused Document object. This is usually the same as document but it will be different when using popout windows.
activeWindowWindowThe actively focused Window object. This is usually the same as window but it will be different when using popout windows.
appAppGlobal reference to the app.
bltypeof Object.hasOwnPropertyMinified reference to Object.hasOwnProperty.
blinkfetchtypeof fetchNative Blink engine fetch, used to bypass patched fetch implementations.
blinkFormDatatypeof FormDataNative Blink engine FormData constructor.
blinkHeaderstypeof HeadersNative Blink engine Headers constructor.
blinkRequesttypeof RequestNative Blink engine Request constructor.
blinkResponsetypeof ResponseNative Blink engine Response constructor.
CapacitorCapacitorGlobalCapacitor runtime for accessing native device APIs on mobile.
CapacitorPlatformsCapacitorPlatformsGlobalRegistry of available Capacitor platform implementations.
Cftypeof Object.getOwnPropertyDescriptorsMinified reference to Object.getOwnPropertyDescriptors.
CodeMirrorCodeMirrorModuleGlobal CodeMirror 5 instance.
CodeMirrorAdapterCodeMirrorAdapterExCodeMirror adapter providing CM5-compatible API over CM6.
DOMPurifyDOMPurifyExDOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG.
Eltypeof Object.propertyIsEnumerableMinified reference to Object.propertyIsEnumerable.
electronElectronModuleElectron module for desktop platform APIs.
electronWindowElectronWindowElectron BrowserWindow instance for the current window.
frameDomFrameDomDOM elements and helpers for the app frame/window chrome.
FSExtractConstructor<CapacitorAdapterFs>Constructor for the Capacitor file system adapter.
i18nextI18nGlobal i18next internationalization framework instance.
MathJax?MathJaxExMathJax instance for rendering mathematical notation.
mermaid?MermaidMermaid library instance for rendering diagrams and charts.
momenttypeof momentParse, validate, manipulate, and display dates in javascript.
mrtypeof Object.getOwnPropertySymbolsMinified reference to Object.getOwnPropertySymbols.
Noticetypeof NoticeNotification component. Use to present timely, high-value information.
OBS_ACT?ObsidianProtocolHandlerInvoke obsidian protocol action.
OBSIDIAN_DEFAULT_I18NLocalizationDefault internationalization strings bundled with Obsidian.
pdfjsLib?PdfJsModulePDF.js library for parsing and rendering PDF documents.
pdfjsTestingUtilsPdfJsTestingUtilsTesting utilities for PDF.js.
PIXIPixiModulePixiJS library for 2D rendering (used for canvas views).
Prism?PrismModulePrism.js syntax highlighting library instance.
requesttypeof requestSimilar to fetch(), request a URL using HTTP/HTTPS, without any CORS restrictions.

Returns the text value of the response.
requestUrltypeof requestUrlSimilar to fetch(), request a URL using HTTP/HTTPS, without any CORS restrictions.
scryptScryptModuleScrypt key derivation function library for password-based encryption.
Sftypeof Object.definePropertiesMinified reference to Object.defineProperties.
temp1Database['changeVersion']Temporary reference to the WebSQL database changeVersion method.
titlebarStylestringThe style of the window title bar (e.g., "hidden", "default").
TurndownServiceTurndownServiceConstructorTurndownService for converting HTML to Markdown.
WebViewElectronWebviewTagElectron WebView tag for embedding external web content.
wftypeof Object.definePropertyMinified reference to Object.defineProperty.

Methods

MethodReturnsDescription
ajax(options)voidSends an AJAX request.
ajaxPromise(options)Promise<any>Sends an AJAX request and returns a promise.
createDiv(o?, callback?)HTMLDivElementCreates a new <div> element.
createEl(tag, o?, callback?)HTMLElementTagNameMap[K]Creates a new element.
createFragment(callback?)DocumentFragmentCreates a new document fragment.
createSpan(o?, callback?)HTMLSpanElementCreates a new <span> element.
createSvg(tag, o?, callback?)SVGElementTagNameMap[K]Creates a new svg element such as <svg>, <circle>, <rect>, etc.
fish(selector)HTMLElement | nullFinds the first element that matches the selector.
fishAll(selector)HTMLElement[]Finds all elements that match the selector.
globalEnhance()voidApply global DOM enhancements and polyfills used by Obsidian.
initVimMode(CodeMirror)VimApivim.js based on https://github.com/codemirror/CodeMirror/commit/793c9e65e09ec7fba3f4f5aaf366b3d36e1a709e (2021-12-04)

Modified from https://github.com/nightwing/cm6-vim-mode-experiment/blob/master/src/vim.js 103a9b5 2021-12-03

CodeMirror, copyright (c) by Marijn Haverbeke and others

Distributed under an MIT license: https://codemirror.net/5/LICENSE

Supported keybindings:

Too many to list. Refer to defaultKeymap below.

Supported Ex commands:

Refer to defaultExCommandMap below.

Registers: unnamed, -, ., :, /, _, a-z, A-Z, 0-9.

(Does not respect the special case for number registers when delete operator is made with these commands: %, (, ), , /, ?, n, N, {, }).

TODO: Implement the remaining registers.

Marks: a-z, A-Z, and 0-9.

TODO: Implement the remaining special marks. They have more complex behavior.

Events:

vim-mode-change - raised on the editor anytime the current mode changes.

Event object: {mode: "visual", subMode: "linewise"}.

Code structure:

1. Default keymap.

2. Variable declarations and short basic helpers.

3. Instance (External API) implementation.

4. Internal state tracking objects (input state, counter) implementation and instantiation.

5. Key handler (the main command dispatcher) implementation.

6. Motion, operator, and action implementations.

7. Helper functions for the key handler, motions, operators, and actions.

8. Set up Vim to work as a keymap for CodeMirror.

9. Ex command implementations.
isBoolean(obj)obj is booleanChecks if the given object is a boolean.
li(target, source)objectMinified helper to copy properties from source to target object.
mo(target, propertyNames)objectMinified helper to omit specified properties from an object.
nextFrame()Promise<void>Waits for the next frame.
openDatabase(name, version, displayName, estimatedSize, creationCallback?)DatabaseOpen or create a WebSQL database.
ready(fn)voidExecutes a function when the DOM is ready.
selectLanguageFileLocation()voidSelect a language file location.
sleep(ms)Promise<void>Sleeps for a given number of milliseconds.
St(target, source)objectMinified helper to merge source properties into target object.
Tl(target, propertyName, propertyValue)unknownMinified helper to set a property on an object.

Links to this page: