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

Property Type Description
activeDocument Document The actively focused Document object. This is usually the same as document but it will be different when using popout windows.
activeWindow Window The actively focused Window object. This is usually the same as window but it will be different when using popout windows.
app App Global reference to the app.
bl typeof Object.hasOwnProperty Minified reference to Object.hasOwnProperty.
blinkfetch typeof fetch Native Blink engine fetch, used to bypass patched fetch implementations.
blinkFormData typeof FormData Native Blink engine FormData constructor.
blinkHeaders typeof Headers Native Blink engine Headers constructor.
blinkRequest typeof Request Native Blink engine Request constructor.
blinkResponse typeof Response Native Blink engine Response constructor.
Capacitor CapacitorGlobal Capacitor runtime for accessing native device APIs on mobile.
CapacitorPlatforms CapacitorPlatformsGlobal Registry of available Capacitor platform implementations.
Cf typeof Object.getOwnPropertyDescriptors Minified reference to Object.getOwnPropertyDescriptors.
CodeMirror CodeMirrorModule Global CodeMirror 5 instance.
CodeMirrorAdapter CodeMirrorAdapterEx CodeMirror adapter providing CM5-compatible API over CM6.
DOMPurify DOMPurify DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG.
El typeof Object.propertyIsEnumerable Minified reference to Object.propertyIsEnumerable.
electron ElectronModule Electron module for desktop platform APIs.
electronWindow ElectronWindow Electron BrowserWindow instance for the current window.
frameDom FrameDom DOM elements and helpers for the app frame/window chrome.
FS ExtractConstructor<CapacitorAdapterFs> Constructor for the Capacitor file system adapter.
i18next I18n Global i18next internationalization framework instance.
MathJax? MathJaxEx MathJax instance for rendering mathematical notation.
mermaid? Mermaid Mermaid library instance for rendering diagrams and charts.
moment typeof moment Parse, validate, manipulate, and display dates in javascript.
mr typeof Object.getOwnPropertySymbols Minified reference to Object.getOwnPropertySymbols.
Notice typeof Notice Notification component. Use to present timely, high-value information.
OBS_ACT ObsidianProtocolHandler Invoke obsidian protocol action.
OBSIDIAN_DEFAULT_I18N Localization Default internationalization strings bundled with Obsidian.
pdfjsLib? PdfJsModule PDF.js library for parsing and rendering PDF documents.
pdfjsTestingUtils PdfJsTestingUtils Testing utilities for PDF.js.
PIXI PixiModule PixiJS library for 2D rendering (used for canvas views).
Prism? PrismModule Prism.js syntax highlighting library instance.
request typeof request Similar to fetch(), request a URL using HTTP/HTTPS, without any CORS restrictions.

Returns the text value of the response.
requestUrl typeof requestUrl Similar to fetch(), request a URL using HTTP/HTTPS, without any CORS restrictions.
scrypt typeof scrypt Scrypt key derivation function library for password-based encryption.
Sf typeof Object.defineProperties Minified reference to Object.defineProperties.
temp1 Database['changeVersion'] Temporary reference to the WebSQL database changeVersion method.
titlebarStyle string The style of the window title bar (e.g., "hidden", "default").
TurndownService TurndownService TurndownService for converting HTML to Markdown.
WebView ElectronWebviewTag Electron WebView tag for embedding external web content.
wf typeof Object.defineProperty Minified reference to Object.defineProperty.

Methods

Method Returns Description
ajax(options) void Sends an AJAX request.
ajaxPromise(options) Promise<any> Sends an AJAX request and returns a promise.
createDiv(o?, callback?) HTMLDivElement Creates a new <div> element.
createEl(tag, o?, callback?) HTMLElementTagNameMap[K] Creates a new element.
createFragment(callback?) DocumentFragment Creates a new document fragment.
createSpan(o?, callback?) HTMLSpanElement Creates a new <span> element.
createSvg(tag, o?, callback?) SVGElementTagNameMap[K] Creates a new svg element such as <svg>, <circle>, <rect>, etc.
fish(selector) HTMLElement | null Finds the first element that matches the selector.
fishAll(selector) HTMLElement[] Finds all elements that match the selector.
globalEnhance() void Apply global DOM enhancements and polyfills used by Obsidian.
initVimMode(CodeMirror) VimApi vim.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 boolean Checks if the given object is a boolean.
li(target, source) object Minified helper to copy properties from source to target object.
mo(target, propertyNames) object Minified helper to omit specified properties from an object.
nextFrame() Promise<void> Waits for the next frame.
openDatabase(name, version, displayName, estimatedSize, creationCallback?) Database Open or create a WebSQL database.
ready(fn) void Executes a function when the DOM is ready.
selectLanguageFileLocation() void Select a language file location.
sleep(ms) Promise<void> Sleeps for a given number of milliseconds.
St(target, source) object Minified helper to merge source properties into target object.
Tl(target, propertyName, propertyValue) unknown Minified helper to set a property on an object.

Links to this page: