` for navigation, the second a `
` for content, separated by a `
` for interactive resizing.
```XML
Select topic from index
```
--------------------------------
### Sciter.js Initiating Drag-n-Drop Operation
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Event.md
Example demonstrating how to structure the `event.detail` object when initiating a drag-n-drop operation using `window.performDrag(...)` in Sciter.js.
```JavaScript
event.detail = { dataType: ...; data: {} }
```
--------------------------------
### Get/Set Multiple Media Variables (Sciter.js)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Window.md
Gets or sets multiple media variables simultaneously using an object.
```js
window.mediaVars([values:object])
```
--------------------------------
### JavaScript Example: Packaging and Unpackaging JSON with BJSON
Source: https://github.com/iakuf/sciter.js-docs/blob/main/JS.runtime/BJSON.md
This example demonstrates how to use the BJSON class to serialize a JavaScript object into a binary ArrayBuffer and then deserialize it back, asserting the correctness of the unpacked data.
```js
let bjson = new BJSON();
// packaging:
let blob = bjson.pack({hello:"world"});
// unpackaging:
bjson.unpack(blob, data => {
console.assert(data.hello =="world");
});
```
--------------------------------
### Window.screenBox() Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Window.md
Reports the geometry and information of a specified screen (monitor). Supports parameters for 'what' and 'boxPart' similar to `window.screenBox()`, and additionally 'devicePixelRatio' to get the ratio of physical to CSS pixels.
```APIDOC
Window.screenBox(screen:integer, what:string, boxPart?:string): any
```
--------------------------------
### Execute Command Example (Sciter.js)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Element/README.md
Example demonstrating how to use `executeCommand` to insert HTML content at the current caret position within an editable element. The insert operation is undoable.
```JavaScript
htmlarea.execCommand("edit:insert-html", html);
```
--------------------------------
### CSS Example: Declaring a LIKE-BUTTON Mixin
Source: https://github.com/iakuf/sciter.js-docs/blob/main/css/media-const-mixin.md
Provides a concrete example of declaring a parametric @mixin named 'LIKE-BUTTON'. This mixin takes a 'color' parameter and defines common inline-block button styles, including background color, border, border-radius, and padding.
```css
@mixin LIKE-BUTTON(color) {
display:inline-block;
background-color: @color;
border: 1px solid #000;
border-radius: 3px;
padding: 0.5em 1em;
}
```
--------------------------------
### CSS Example: Applying `morph()` for Lightness Adjustment in Sciter.js
Source: https://github.com/iakuf/sciter.js-docs/blob/main/css/units/color.md
Demonstrates how to use the `morph()` function in CSS within Sciter.js to modify the lightness of a base color. The example defines a constant `BASECOLOR` and applies a `lighten:25%` transformation to a `div`'s background.
```CSS
@const BASECOLOR: #0C0;
div {
background: morph(@BASECOLOR, lighten:25%);
}
```
--------------------------------
### Access and Populate Persistent Data (JavaScript)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/storage/introduction.md
This example illustrates how to interact with persistent data stored under `storage.root` using standard JavaScript operations. It shows iterating through a persistent array (`root.children`) and adding new objects to it, demonstrating that no special methods are required for data manipulation.
```js
// printout elements of root.children collection (array)
let root = storage.root;
for( let child of root.children )
console.log(child.name, child.nickname);
```
```js
var collection = root.children; // plain JS array
collection.push( { name: "Mikky", age: 7 } ); // calling Array's method push() to add
collection.push( { name: "Olly", age: 6 } ); // objects to the collection
collection.push( { name: "Linus", age: 5 } );
```
--------------------------------
### Open or Create Storage and Initialize Root Object (JavaScript)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/storage/introduction.md
This snippet demonstrates the idiomatic way to open an existing database file or create a new one using `Storage.open(path)`. It shows how to retrieve the `storage.root` object, which holds all persistent data, and how to initialize its structure if the database is newly created and empty.
```js
import * as Storage from "storage"; // or "@storage" if Sciter.JS
var storage = Storage.open("path/to/data/file.db");
var root = storage.root || initDb(storage); // get root data object or initialize DB
```
```js
function initDb(storage) {
storage.root = {
version: 1, // integer property ("integer field" in DB terms)
meta: {}, // sub-object
children: [] // sub-array, empty initially
};
return storage.root;
}
```
--------------------------------
### Render a Sciter.js Component to the DOM
Source: https://github.com/iakuf/sciter.js-docs/blob/main/reactor/component.md
This example demonstrates how to render a user-defined Sciter.js component to the document body. It shows the component definition, creation of a virtual element representing the component, and finally, using `document.body.content()` to insert it into the DOM.
```js
function Welcome(props) {
return Hello, {props.name}! ;
}
const velement = ;
document.body.content(velement);
```
--------------------------------
### Getting integer value of Graphics.Color
Source: https://github.com/iakuf/sciter.js-docs/blob/main/graphics/Color.md
Example of calling the `valueOf()` method on a `Graphics.Color` instance. This method returns an integer representation of the color, packaged as a 32-bit unsigned integer (`uint32`) in the format `(a << 24) | (b << 16) | (g << 8) | (r)`.
```js
color.valueOf()
```
--------------------------------
### Window Class Constructor
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Window.md
Initializes a new desktop window instance. The constructor accepts an object with various parameters to configure the window's appearance and behavior.
```js
new Window({params:object})
```
```APIDOC
params: object - An object containing window configuration properties.
type: string - Optional, is one of:
Window.POPUP_WINDOW
Window.TOOL_WINDOW
Window.CHILD_WINDOW
Window.FRAME_WINDOW - default window type
Window.DIALOG_WINDOW
parent: Window - Optional, instance of parent (owner window). When owner is closed or minimized then this window will be closed/minimized too. parent defines z-order of this new window. Window with the defined parent will always float on top its parent.
caption: string - Optional, window caption (or title).
x: integer - Optional, screen pixels, horizontal position of the window on screen;
y: integer - Optional, screen pixels, vertical position of the window from the top of the screen;
width: integer - screen pixels, window width;
height: integer - screen pixels, window height;
client: true | false - if true then x,y,w,h are coordinates of desired window client box on the screen;
alignment: integer - Optional, [1 to 9] alignment of the window on monitor, if [-1 to -9] and parent is provided then it aligns the window against parent window. (1 bottom left corner, 2 bottom middle, 3 bottom right corner, 4 middle left, 5 center, 6 middle right, 7 top left corner, 8 top middle, 9 top right corner)
screen: integer - Optional, number of monitor on multi-home systems.
state: integer - Optional - window state, is one of:
Window.WINDOW_SHOWN - default state
Window.WINDOW_MINIMIZED
Window.WINDOW_MAXIMIZED
Window.WINDOW_HIDDEN
Window.WINDOW_FULL_SCREEN
url: string - Optional, window html source code file.
parameters: array | string | object, ... - Optional, extra parameters to pass to the new window.
```
--------------------------------
### Range collapse() Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Node/Range.md
Collapses the Range to a single point, either at its start or end position. If 'toStart' is true, end = start; otherwise, start = end.
```js
range.collapse([toStart:bool])
```
--------------------------------
### Start or Reset Element Timer (Sciter.js)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Element/README.md
Starts a timer associated with the element. If a timer with the same callback already exists, it is removed and a new one is started, enabling effective throttling. The timer continues to tick like an interval if the callback function returns true.
```js
element.timer(milliseconds, callback: function)
```
```APIDOC
Starts timer on element. If the element already has timer with that callback it first gets removed and new timer started instead. This allows to implement effective throttling. If the callback function returns true value then the timer will keep ticking (like interval timer). The callback is called with this set to the element.
```
--------------------------------
### JavaScript: Opening Storage and Accessing Root Object
Source: https://github.com/iakuf/sciter.js-docs/blob/main/storage/architecture.md
This JavaScript code demonstrates the initial steps to interact with Sciter's persistence mechanism. It shows how to open an existing storage file using `Storage.open()` and then access the `root` data object, which serves as the entry point to the stored data.
```JavaScript
var storage = Storage.open("path/to/data/file.db");
var root = storage.root; // root data object
```
--------------------------------
### Basic Sciter Reactor DOM Patching with JSX
Source: https://github.com/iakuf/sciter.js-docs/blob/main/reactor/README.md
Illustrates the fundamental 'Hello World' example using Sciter's Reactor. It shows how `document.body.patch()` directly accepts a JSX literal to update the DOM, and the resulting HTML structure. No external pre-compilers are needed as JSX is integral to SciterJS.
```js
document.body.patch(Hello, world!);
```
```XML
Hello, world!
```
--------------------------------
### Form Value Example - Basic Inputs
Source: https://github.com/iakuf/sciter.js-docs/blob/main/behaviors/behavior-form.md
Demonstrates how simple text inputs within a form are mapped to a JSON object, where input names become keys and their values become corresponding JSON values.
```XML
```
```JSON
{
first: "Foo",
last: "Bar"
}
```
--------------------------------
### Zip Class: Accessing Mounted Archive Content
Source: https://github.com/iakuf/sciter.js-docs/blob/main/JS.runtime/Zip.md
Examples of accessing resources (images, modules) from a mounted zip archive using its virtual URL.
```html
```
```js
import {Bar} from "this://mounts/test/bar.js";
```
--------------------------------
### Sciter.js @env Module API Reference
Source: https://github.com/iakuf/sciter.js-docs/blob/main/JS.runtime/module-env.md
Detailed API documentation for the `@env` module in Sciter.js, covering constants for OS and device identification, and functions for language, country, user, machine, domain names, command-line arguments, launching applications, managing paths, environment variables, and executing external commands.
```APIDOC
module @env:
constants:
OS: string
OS identification name, for example "Windows-8.1"
PLATFORM: string
OS/platform generic name: "Windows", "OSX", "Linux", "Android", etc.
DEVICE: string
device type: "desktop", "mobile"
functions:
language(): string
Returns two-letter language abbreviation of user's default language, for example "en" for English.
country(): string
Returns two-letter country abbreviation, for example "CA" for Canada.
userName(): string
Returns current user name.
machineName(): string
Machine network name.
domainName(): string
Machine network domain.
arguments(): string[]
Returns array of command line arguments.
launch(path: string): void
Method to open documents and start applications;
Example: env.launch("https://sciter.com") will open default browser with that url.
home(relpath?: string): string
Converts relative path to absolute path using location of sciter.dll as a base.
homeURL(relpath?: string): string
Same as env.home(relpath) but returns "file://..." URL.
path(name: string, relpath?: string): string
Returns location of well known folders on user machine, name is one of:
- "home" - user's home folder;
- "applications" - applications a.k.a program files;
- "root" - file system root;
- "desktop" - desktop folder;
- "appdata" - applications data folder;
- "downloads"
- "documents"
- "music"
- "videos"
- "pictures"
If relpath is provided the function returns absolute path of that relpath combined with the folder path.
pathURL(name: string): string
Same as env.path(name) but returns "file://..." URL.
variable(name: string, toset?: string | null): string
getenv/setenv(,,true)/unsetenv() ( if toset is null )
exec(...args: string[]): void
execute comma-separated arguments. Example: exec("scapp.exe", "main.html")
```
--------------------------------
### Storage Class API (APIDOC)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/storage/introduction.md
Documentation for the `Storage` class, which represents a database file. It details the `Storage.open()` method for creating or opening databases and the `storage.root` property, which provides access to the top-level persistent object or array.
```APIDOC
Storage:
open(path: string): Storage
path: Path to the database file.
Returns: An instance of the Storage class on success.
root: object | array | null
Description: Reference to the stored root object or array.
Note: All objects accessible from (contained in) the 'storage.root' object are automatically persistent.
Usage: Ordinary script object for accessing and/or modifying data in storage using standard script means.
```
--------------------------------
### Open and Initialize Sciter.js Database Structure
Source: https://github.com/iakuf/sciter.js-docs/blob/main/storage/introduction.md
This JavaScript function opens a Sciter.js database at a specified pathname. If the database is new (i.e., `ndb.root` is not set), it initializes the root structure with a unique ID index (`id2item`), a date index (`date2item`), and placeholder objects for `tags` and `books`, along with a version number. It then returns the database object.
```js
//|
//| open database and initialize it if needed
//|
function openDatabase(pathname)
{
//const DBNAME = "sciter-notes.db";
//const pathname = dbPathFromArgs() || ...;
var ndb = Storage.open(pathname);
if(!ndb.root) {
// new db, initialize structure
ndb.root =
{
id2item :ndb.createIndex("string", true), // main index, item.id -> item, unique
date2item :ndb.createIndex("date", false), // item by date of creation index, item.cdate -> item, not unique
tags :{}, // map of tagid -> tag
books :{}, // map of bookid -> book;
version :1,
};
}
ndb.path = pathname;
return ndb;
}
```
--------------------------------
### Audio Class API Reference
Source: https://github.com/iakuf/sciter.js-docs/blob/main/JS.runtime/Audio.md
This section defines the `Audio` class, outlining its structure, static methods, properties, and instance methods. It covers how to load audio files, control playback progress and volume, and manage the playback state.
```APIDOC
class Audio:
description: Represents an object that allows to play audio, e.g. mp3 files.
static_methods:
load(url: string): Promise
description: Load audio file and return promise that will be resolved to Audio object.
throws: "404" exception if file not found.
properties:
progress: float (range 0.0 ... 1.0)
description: Progress of playing.
volume: float (range 0.0 ... 1.0)
description: Sound volume.
methods:
play(): Promise
description: Plays the sound, returns promise that will be resolved at the end of playback.
pause(): void
description: Pauses playback.
resume(): void
description: Resumes paused playback.
stop(): void
description: Stops playback.
```
--------------------------------
### JavaScript Rect.moveTo() Example
Source: https://github.com/iakuf/sciter.js-docs/blob/main/graphics/Rect.md
Illustrates how to use the `moveTo` method to create a new rectangle by repositioning one of its points. In this example, the bottom-right point (3) of `rc` is moved to `Point(10,10)`, resulting in a new rectangle with its origin at `Point(0,0)`.
```js
const rc = Rect(Point(10,10), Size(10,10));
const moved = rc.moveTo(Point(10,10),3);
// moved origin == Point(0,0);
```
--------------------------------
### HTML Window Chrome Elements Example
Source: https://github.com/iakuf/sciter.js-docs/blob/main/HTML/html-window.md
Demonstrates how to use `role` attributes on HTML elements to define window chrome behaviors like dragging, minimizing, maximizing, and closing the window, along with a window icon.
```html
```
--------------------------------
### Implementing Cancelable Fetch Requests in Sciter
Source: https://github.com/iakuf/sciter.js-docs/blob/main/JS.runtime/Fetch.md
Provides a JavaScript code example demonstrating how to create and manage cancelable `fetch` requests in Sciter. It shows how to instantiate a `Request` object, wire an event handler to abort the request, issue the `fetch` call with `await`, and handle both successful responses and aborted or error states using `try-catch`.
```JavaScript
// creating request:
let request = new Request("url", options);
// wiring click eevent handler that will abort the request:
document.on("click", "button#abort", function(){
request.abort();
})
// issuing the request:
try {
let response = await fetch(request);
if(response.ok)
//... handle response data here ...
else if(response.status == 404)
//... wrong url ...
else
//... etc. ...
} catch(response) {
if(response.aborted)
//... ended by ,abort() call ...
else
//... some other problems, see response.status ...
}
```
--------------------------------
### Using Sciter Stock Icons in HTML
Source: https://github.com/iakuf/sciter.js-docs/blob/main/css/paths-and-vector-images.md
This HTML example demonstrates how to easily integrate Sciter's internal library of stock vector icons. By using the `icon:` URL schema in an ` ` tag, developers can reference pre-defined icons like 'right' without needing to specify path data.
```html
```
--------------------------------
### Sciter.js Bootstrap `run.js` Configuration and Startup
Source: https://github.com/iakuf/sciter.js-docs/blob/main/scapp/bootstrap-runtime-mode.md
This JavaScript snippet demonstrates a typical `run.js` file used in Sciter.js bootstrap mode. It configures the graphics backend based on the operating system, creates a main application window, and initiates the UI message pump loop. It uses `@env` and `@sys` modules for environment and system interactions.
```js
import * as env from "@env";
import * as sys from "@sys";
let startup;
let gfx = "gpu"; // use best GPU backend...
switch(env.PLATFORM) {
case "Windows":
startup = "main-win.js";
break;
case "OSX":
startup = "main-mac.js";
gfx = "opengl"; // force using OpenGL instead of Metal
break;
default:
startup = "main-linux.js";
break;
}
application.start(gfx); // configure graphics backend
const mainWindow = new Window({
url:__DIR__ + "hello.htm",
parameters: {} // parameters to pass
});
mainWindow.on("close",() => application.quit(0));
//... other initialization ...
let quitVal = application.run(); // message pump loop
//... shutdown ...
```
--------------------------------
### Range setEndAfter() Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Node/Range.md
Set start position so it will include end of the _node_.
```js
range.setEndAfter(node)
```
--------------------------------
### API: window.activate
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Window.md
API definition for the `window.activate` method, which sets input focus on the window. An optional boolean parameter can be used to bring the window to the front.
```APIDOC
window.activate(bringToFront: boolean)
bringToFront: boolean - If true, brings the window to the foreground.
```
--------------------------------
### Implementing the componentDidMount() Lifecycle Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/reactor/component-lifecycle.md
Illustrates the `componentDidMount()` method, invoked after a component is inserted into the DOM, suitable for DOM-related initialization and setting up subscriptions.
```js
class Comp extends Element {
componentDidMount() { ... }
}
```
--------------------------------
### Range setStartAfter() Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Node/Range.md
Sets the start position of the Range to exclude the beginning of the specified node.
```js
range.setStartAfter(node)
```
--------------------------------
### Sciter.js `application` Bootstrap API Reference
Source: https://github.com/iakuf/sciter.js-docs/blob/main/scapp/bootstrap-runtime-mode.md
This section details the `application` namespace functions available during the Sciter.js bootstrap phase. These functions are crucial for configuring the graphics layer, starting the UI message pump, and gracefully quitting the application. Note that during bootstrap, DOM-related functions, `fetch()`, `setTimeout`, `setInterval`, and `post()` are not available.
```APIDOC
application:
start(gfx: string)
Selects graphics layer to be used.
gfx: one of:
"raster" - software rasterization backend
"direct2d-warp" - Windows only; Direct2d WARP backend
"direct2d" - Windows only; Direct2D GPU backend - default on Windows
"opengl" - all platforms; Skia/OpenGL backend
"vulkan" - Windows, Linux; Skia/Vulkan backend
"metal" - MacOS only; Skia/Metal backend
"gpu" - default value; uses best (fastest) backend available. On some [old] systems, modern backends (Metal,Vulkan) may work unreliable so you may choose other backends like "opengl".
run(): int
Starts the UI application's message pump loop. The function will return only when `application.quit()` is issued.
quit(retval: int)
Requests to exit from `application.run()` loop. The `run()` function will return that `retval` value.
```
--------------------------------
### Range setStartBefore() Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Node/Range.md
Sets the start position of the Range to include the beginning of the specified node.
```js
range.setStartBefore(node)
```
--------------------------------
### Range setStart() Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Node/Range.md
Sets the start position of the Range object to a specified node and offset.
```js
range.setStart(node,offset)
```
--------------------------------
### JavaScript: Initial State of Root Object with Proxies
Source: https://github.com/iakuf/sciter.js-docs/blob/main/storage/architecture.md
This conceptual JavaScript representation illustrates the state of the `root` object immediately after it is loaded. Sub-collections within the root object are initially represented as internal `proxy-ref`erences, meaning their data is not yet loaded into memory.
```JavaScript
storage.root -> {
version: 1,
parent: /*proxy-ref*/
children: /*proxy-ref*/
}
```
--------------------------------
### Pager Property: page (read-write)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/behaviors/behavior-pager.md
Read-write property for getting or setting the current page number.
```APIDOC
frame.pager.page: integer
Read-write, current page
```
--------------------------------
### Loading Sciter Archive Content with this://app/ Scheme (C++)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/URL-sciter-schemes.md
Shows how to bind a resource blob with a Sciter archive instance and load an HTML file from it using the `this://app/` URL scheme. This scheme accesses resources compiled into the application via `packfolder` utility.
```cpp
// bind resource blob with sciter::archive instance:
sciter::archive::instance().open(aux::elements_of(resources)); // bind resources[] (defined in "resources.cpp") with the archive
...
window->load(WSTR("this://app/default.htm"));
```
--------------------------------
### Clipboard Namespace API Reference
Source: https://github.com/iakuf/sciter.js-docs/blob/main/JS.runtime/Clipboard.md
Detailed API documentation for the `Clipboard` namespace, including methods for interacting with the system clipboard.
```APIDOC
Clipboard namespace:
Description: Includes functions dealing with system clipboard.
Methods:
read(): ClipboardDataObject
Description: Returns an object containing clipboard data.
readText(): string | undefined
Description: Returns either a string or undefined if clipboard does not contain textual data.
write(data: ClipboardDataObject): boolean
Description: Puts data into the clipboard.
Parameters:
data: ClipboardDataObject - The data to put into the clipboard.
writeText(string): boolean
Description: Puts the string into the clipboard.
Parameters:
string: string - The string to put into the clipboard.
has(type: string): boolean
Description: Checks if the clipboard contains data of a given type.
Parameters:
type: string - The type of data to check for. Valid types: "text", "html", "image", "file", "json", "link".
```
--------------------------------
### Range selectNodeContents() Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Node/Range.md
Configures the Range to include only the content of the specified node, excluding its start and end positions.
```js
range.selectNodeContents(node)
```
--------------------------------
### Range selectNode() Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Node/Range.md
Configures the Range to encompass the entire specified node, including its start and end positions.
```js
range.selectNode(node)
```
--------------------------------
### Initialize Sciter.js Storage with Date and ID Indexes
Source: https://github.com/iakuf/sciter.js-docs/blob/main/storage/introduction.md
This JavaScript function initializes a Sciter.js storage database by creating two indexes on the root object: `notesByDate` (a non-unique index for notes by creation date) and `notesById` (a unique index for notes by a unique ID). It sets the storage version and returns the root object.
```js
function initNotesDb(storage) {
storage.root = {
version: 1,
notesByDate: storage.createIndex("date",false), // list of notes indexed by date of creation
notesById: storage.createIndex("string",true) // list of notes indexed by their UID
}
return storage.root;
}
```
--------------------------------
### Get Root Node in JavaScript
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Node/README.md
Retrieves the root node of the current node. In Sciter, this always returns the ownerDocument.
```js
node.getRootNode(): Document | null
```
--------------------------------
### Index Class API (APIDOC)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/storage/introduction.md
Documentation for the `Index` class, a keyed persistent collection that supports ordered access and efficient retrieval of data. It describes the `storage.createIndex()` method used to define and populate indexes with specified key types and uniqueness constraints.
```APIDOC
Index:
Description: A keyed persistent collection that can be assigned to properties of other persistent objects or placed into arrays. Provides effective access and ordering of potentially large data sets.
Supported Key Types: "string", "integer", "long" (BigInt), "float", "date".
Contains: Objects as index elements (records).
storage.createIndex(type: string, unique?: boolean): Index
type: Defines the type of keys in the index.
Allowed values: "string", "integer", "long", "float", "date".
unique: Specifies if the index supports only unique keys.
true: Only unique keys are allowed.
false: Records with the same key values are allowed.
Returns: An instance of the Index class.
```
--------------------------------
### Range setToMark() Method (Sciter specific)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Node/Range.md
Setups the range to start/end of character range having _name_ mark set.
```js
range.setToMark(name)
```
--------------------------------
### Implementing the constructor() Lifecycle Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/reactor/component-lifecycle.md
Explains the optional `constructor()` method for Reactor components, its invocation order, and the JavaScript requirement to call `super()` for derived classes.
```js
class Comp extends Element {
constructor(props,kids) { super(); ...}
}
```
--------------------------------
### Load New Document into Window (Sciter.js)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Window.md
Loads a new document into the window. It is almost always better to use a ` ` inside the window and load the needed document there instead of using this method directly.
```js
Window.this.load(url:string)
```
```js
document.$("frame.content").src = url;
```
--------------------------------
### Pager Method: print
Source: https://github.com/iakuf/sciter.js-docs/blob/main/behaviors/behavior-pager.md
Starts printing the entire document or specific pages provided in an array of page numbers.
```APIDOC
frame.pager.print([arrayOfPageNumbers]);
Starts printing of whole document or particular pages contained in _arrayOfPageNumbers_ (like `[1,3,5]`)
```
--------------------------------
### Getting Virtual Node Children with Reactor.kidsOf()
Source: https://github.com/iakuf/sciter.js-docs/blob/main/reactor/reactor-api.md
Retrieves the children collection of a Reactor virtual node as an array.
```APIDOC
Reactor.kidsOf(vnode) : Array
```
```js
Reactor.kidsOf(bar
)[0] == "bar"; // true
```
--------------------------------
### Pager Property: documentName
Source: https://github.com/iakuf/sciter.js-docs/blob/main/behaviors/behavior-pager.md
Read-write property for setting or getting the name of the document, visible in printing job queues.
```APIDOC
frame.pager.documentName: string
Read-write, name of the document (can be seen in printing jobs queue)
```
--------------------------------
### Fetching Local File with home:// Scheme in Sciter (JavaScript)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/URL-sciter-schemes.md
Demonstrates how to fetch a local file, such as `config.json`, using the `home://` URL scheme. This scheme accesses files relative to the Sciter DLL/SO or application executable's location.
```js
let res = await fetch("home://config.json");
```
--------------------------------
### Calendar Properties
Source: https://github.com/iakuf/sciter.js-docs/blob/main/behaviors/behavior-calendar.md
Details the `mode` property available on the calendar object for getting or setting the current view mode programmatically.
```APIDOC
Properties:
element.calendar.mode: string
- Type: "days" | "months" | "years" | "century"
- Description: gets/sets current view mode.
```
--------------------------------
### Sciter.js HTML `` Element for Component Mounting
Source: https://github.com/iakuf/sciter.js-docs/blob/main/reactor/component-styles-events.md
This HTML snippet illustrates the use of Sciter's special `` element as a direct mounting point for components. It specifies the component type ('Tabs') and its source file ('tabs.js'), with nested `` elements providing initial content or references to external HTML.
```html
Test of Tabs component.
First tab content
Second tab content
```
--------------------------------
### Get device pixel ratio
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Globals.md
The number of physical screen pixels per logical CSS pixel (dip).
```APIDOC
devicePixelRatio: float
```
--------------------------------
### API: window.selectFolder
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Window.md
API definition for the `window.selectFolder` method, which opens a folder selection dialog. It allows specifying a caption and initial path, returning the URL of the selected folder.
```APIDOC
window.selectFolder(params: object)
params:
caption: string - title of dialog
path: string - initial directory
returns: string - folder URL
```
--------------------------------
### fs.sync.lstat / fs.lstatSync: Synchronously Get Link Status
Source: https://github.com/iakuf/sciter.js-docs/blob/main/JS.runtime/module-sys.md
This is the synchronous version of `fs.lstat()`. It returns the 'stat' structure for a symbolic link directly.
```APIDOC
fs.sync.lstat(path: string): stat
fs.lstatSync(path: string): stat
path: string - The path to the file or symbolic link.
Returns: stat - A stat object for the link itself.
```
--------------------------------
### APIDOC: behavior:select Properties
Source: https://github.com/iakuf/sciter.js-docs/blob/main/behaviors/behavior-select.md
Documentation for properties supported by `behavior:select`, including `options` and `select.currentOption`.
```APIDOC
options: Element
Description: Reference to DOM element that holds list (in this case, the select element itself).
select.currentOption: Element (read/write)
Description: Reference to DOM element that represents current option.
```
--------------------------------
### Intl.DateTimeFormat dateFormatPattern() Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/JS.runtime/Intl-i18n.md
Returns the date format pattern used by the instance, for example: 'MMM d, y', based on UNICODE specifications.
```APIDOC
Intl.DateTimeFormat.dateFormatPattern(): string
```
--------------------------------
### Zip Class: Opening and Mounting Archive
Source: https://github.com/iakuf/sciter.js-docs/blob/main/JS.runtime/Zip.md
Demonstrates how to open a remote zip archive using `Zip.openData` and mount it to a virtual URL (`this://mounts/test/`) for easy access.
```js
const rs = await fetch("remote url");
const archive = Zip.openData(rs.arrayBuffer());
archive.mountTo("this://mounts/test/");
```
--------------------------------
### Get/Set Single Media Variable (Sciter.js)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Window.md
Gets or sets a single media variable that can be used in CSS with `@media varname {...}`.
```js
window.mediaVar(varname[,value])
```
--------------------------------
### Window.post() Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Window.md
Posts a global event to all windows within the current process asynchronously.
```APIDOC
Window.post(ge: Event): void
```
--------------------------------
### Get CSS Property Value in JavaScript
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Element/Style.md
Retrieves the value of a specified CSS property from an element's style using `getPropertyValue()`.
```js
element.style.getPropertyValue(name)
```
--------------------------------
### Get Owner Element by Selector in Sciter.js
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Element/README.md
Returns the owner element matching the `selector`, useful for retrieving owners of menus and popups.
```js
const owner = this.$o(selector)
```
--------------------------------
### Create Directory (fs.mkdir)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/JS.runtime/module-sys.md
Creates a new directory at the specified path. An optional `mode` can be provided to set permissions, defaulting to `0o777`. Both asynchronous and synchronous versions are available.
```APIDOC
fs.mkdir(path[, mode = 0o777]): Promise
fs.sync.mkdir(path[, mode = 0o777])
fs.mkdirSync(path[, mode = 0o777])
```
--------------------------------
### JavaScript: Creating a Storage.Index
Source: https://github.com/iakuf/sciter.js-docs/blob/main/storage/Storage.Index.md
Demonstrates how to initialize a new `Storage.Index` object within the persistent storage root, specifying its key type. This index can then be used to store and retrieve objects by their unique identifiers.
```js
storage.root = {
version:1,
notes: storage.createIndex("string") // note by id (string, GUID) index
}
```
--------------------------------
### Range nodes() Method (Sciter specific)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Node/Range.md
Returns a list of all Node objects covered by the range, meaning all nodes that have either their start or end inside the range.
```js
range.nodes():array
```
--------------------------------
### Window.all Property
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Window.md
A list of all Sciter windows currently open in the process, including the current window. Useful for enumerating and interacting with other windows.
```APIDOC
Window.all: Array
```
```js
for(let wnd of Window.all)
...
```
--------------------------------
### Sciter CSS @mixin Rule Usage Example
Source: https://github.com/iakuf/sciter.js-docs/blob/main/css/media-const-mixin.md
Shows how to apply a defined mixin within a CSS rule by referencing its name prepended with @.
```css
some {
@mname;
color: black;
...
}
```
--------------------------------
### Compose Multiple Sciter.js Components
Source: https://github.com/iakuf/sciter.js-docs/blob/main/reactor/component.md
This snippet illustrates how to compose multiple Sciter.js components within a parent component. It defines a `Welcome` component and an `App` component that renders multiple instances of `Welcome`, demonstrating component reusability and hierarchical structure.
```js
function Welcome(props) {
return Hello, {props.name}! ;
}
function App() {
return
;
}
document.body.patch( );
```
--------------------------------
### Sciter CSS @const Rule Usage Example
Source: https://github.com/iakuf/sciter.js-docs/blob/main/css/media-const-mixin.md
Demonstrates how to use a previously defined constant within CSS rules by prepending its name with @.
```css
@const BACKGROUND: no-repeat url(...) 50% 50%;
...
body {
background: @BACKGROUND;
}
```
--------------------------------
### Graphics.Point Constructor Overloads
Source: https://github.com/iakuf/sciter.js-docs/blob/main/graphics/Point.md
Details the different ways to instantiate a Point object, including default, copy, conversion from Size, and direct x,y coordinate initialization.
```APIDOC
Point(): constructs 0,0 point
Point(Point): constructs copy of the point
Point(Size): constructs point by converting it from _Size_
Point(x,y): constructs pont from two numbers
```
--------------------------------
### XML: Hierarchical Select with Grouped Options
Source: https://github.com/iakuf/sciter.js-docs/blob/main/behaviors/behavior-select.md
Shows an example of a `` element with nested `` elements, demonstrating a hierarchical tree structure where groups can be expanded.
```XML
Group A
Red
Green
Blue
Group B
...
```
--------------------------------
### Import specific functions from @sciter module
Source: https://github.com/iakuf/sciter.js-docs/blob/main/JS.runtime/module-sciter.md
Demonstrates how to import individual functions like on, off, and once from the @sciter module for direct use.
```js
import {on,off,once} from "@sciter";
on("click", event => {...});
```
--------------------------------
### Get Pixel Color from Graphics.Image
Source: https://github.com/iakuf/sciter.js-docs/blob/main/graphics/Image.md
Retrieves the color of a specific pixel at the given x and y coordinates from the Graphics.Image. Returns a Color object or null if the coordinates are out of bounds.
```js
image.colorAt(x,y): Color | null
```
--------------------------------
### Get CSS Image Property as Graphics.Image in JavaScript
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Element/Style.md
Reports the used value of a CSS property as an instance of `Graphics.Image`. Returns null if the property is not an image.
```js
element.style.imageOf(name):Image
```
--------------------------------
### JavaScript: Transparent Loading of Sub-Objects on Access
Source: https://github.com/iakuf/sciter.js-docs/blob/main/storage/architecture.md
This JavaScript snippet demonstrates how accessing a property of a sub-object (e.g., `root.parent.name`) triggers the transparent loading of that sub-object from the database into the VM's heap. This mechanism ensures data is fetched only when needed.
```JavaScript
console.log(root.parent.name);
```
--------------------------------
### Implementing the componentWillUnmount() Lifecycle Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/reactor/component-lifecycle.md
Shows the `componentWillUnmount()` method, called just before a component is removed from the DOM, ideal for performing necessary cleanup tasks.
```js
class Comp extends Element {
componentWillUnmount() { ... }
}
```
--------------------------------
### Get CSS Color Property as Graphics.Color in JavaScript
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Element/Style.md
Reports the value of a CSS property as an instance of `Graphics.Color` class. Returns null if the property is not a color.
```js
element.style.colorOf(name): Color
```
--------------------------------
### Sciter.js Move/Size Window with move() Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Window.md
The move() method allows repositioning and resizing the window. Coordinates and dimensions are typically in physical screen pixels (PPX), but can be treated as client area coordinates if specified.
```APIDOC
window.move(x, y [, width, height [, "client" ]])
Description: Moves and/or sizes the window.
Parameters:
x: number
Description: New X coordinate.
y: number
Description: New Y coordinate.
width: number (optional)
Description: New width.
height: number (optional)
Description: New height.
"client": string (optional)
Description: If provided, x, y, width, height are treated as window client area coordinates instead of overall window coordinates.
Notes: x, y, width, height are in PPX (physical screen pixels) unless "client" is provided.
```
--------------------------------
### Lottie Behavior Custom Events
Source: https://github.com/iakuf/sciter.js-docs/blob/main/behaviors/behavior-lottie.md
Lists the custom events generated by the `behavior:lottie` module, providing notifications for animation lifecycle stages such as start, loop, and end.
```APIDOC
"animationstart": the animation has been loaded successfully and animation has been started.
"animationloop": last frame shown and animation restarted from its beginning.
"animationend": animation playback stopped.
```
--------------------------------
### JavaScript: Iterating with Storage.Index.select()
Source: https://github.com/iakuf/sciter.js-docs/blob/main/storage/Storage.Index.md
Demonstrates how to use the `select()` method of `Storage.Index` to iterate over a filtered range of items. This example shows a `for...of` loop with `minVal` and `maxVal` for range-based enumeration.
```js
for( const obj in index.select(minVal, maxVal) ) {
...
}
```
--------------------------------
### Sciter JSX_translateTags Configuration Example
Source: https://github.com/iakuf/sciter.js-docs/blob/main/reactor/JSX-i18n.md
Shows how to configure JSX_translateTags, a global map that specifies HTML tags whose content should be translated by default without explicit markers.
```js
JSX_translateTags = {
"caption": true,
"label": true,
"button": true,
"span": true
};
```
--------------------------------
### Simple Dropdown Select XML Structure
Source: https://github.com/iakuf/sciter.js-docs/blob/main/behaviors/behavior-select-dropdown.md
Demonstrates the basic XML structure for a `` element with `` tags, showing initial selection.
```XML
Red
Green
Blue
```
--------------------------------
### Get native Asset class name (JavaScript)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/JS.runtime/Asset.md
Returns the native class name of an Asset object. Can be used in conjunction with `instanceof Asset` for robust type checking.
```js
let rs = db.exec("select * from stocks order by price");
if ( rs instanceof Asset && Asset.typeOf(rs) === "Recordset" )
showRecordset(rs);
else
$("#result").innerText = "Wrong type:" + rs;
```
--------------------------------
### Window Events Subscription
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Window.md
General method for subscribing to window-related events using `window.on("eventname", handler)`.
```APIDOC
window.on("eventname", handler)
```
--------------------------------
### Get CSS Length Property as Pixels in JavaScript
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Element/Style.md
Reports the used value of a CSS property as a number of CSS pixels. Returns null if the property is not a length.
```js
element.style.pixelsOf(name): number
```
--------------------------------
### Default HTML5 Usage with Sciter Behavior
Source: https://github.com/iakuf/sciter.js-docs/blob/main/behaviors/behavior-details.md
Illustrates the standard application of the `behavior:details` to an HTML5 `` element, enabling its default expand/collapse functionality.
```HTML
Details
Something small enough to escape casual notice.
```
--------------------------------
### Get String Representation (Sciter.js Element)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Element/README.md
Returns a short string representation of the element. This method is primarily used for debugging purposes to quickly identify an element.
```js
element.toString() : string
```
--------------------------------
### Initialize and Use Graphics.Size Object
Source: https://github.com/iakuf/sciter.js-docs/blob/main/graphics/Size.md
Demonstrates various ways to construct `Size` objects using different constructors and applying arithmetic operators like addition and subtraction to `Size` instances.
```js
const sz1 = Size(10,10);
const sz2 = Size.make(20,20);
const sz3 = Size(Rect(10,10,100,100)); // size of the rect, 100,100
// operators
const sum = Size(0,0) + Size(50,50);
const sub = Size(0,0) - Size(50,50); // [-50,-50]
```
--------------------------------
### Get N-th Child Element in Sciter.js DOM
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Element/README.md
Returns the n-th child element of the `element`. The index `n` must be within the range [0, `element.childElementCount`).
```js
element.childElement(n) : element | null
```
--------------------------------
### Sciter.js Move/Size Window to Specific Monitor with moveTo() Method
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Window.md
The moveTo() method allows moving and resizing the window to a specific monitor. Coordinates and dimensions are specified in DIPs (device independent pixels, or CSS pixels).
```APIDOC
window.moveTo(monitor, x, y [, width, height [, "client" ]])
Description: Moves and/or sizes the window to a particular monitor.
Parameters:
monitor: any
Description: The target monitor.
x: number
Description: New X coordinate in DIPs.
y: number
Description: New Y coordinate in DIPs.
width: number (optional)
Description: New width in DIPs.
height: number (optional)
Description: New height in DIPs.
"client": string (optional)
Description: If provided, x, y, width, height are treated as window client area coordinates.
Notes: x, y, width, height are in DIPs (device independent pixels / CSS pixels).
```
--------------------------------
### Sciter.js Pager (Print Preview) Events
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Event.md
Describes events specific to the element used for print preview, tracking the start, page completion, and end of pagination.
```APIDOC
Pager (Print Preview) Events ( ):
paginationstart (pagination-start): Pagination has been started on the frame/pager.
paginationpage (pagination-page): Pagination of one page complete.
paginationend (pagination-ended): Pagination has been ended.
```
--------------------------------
### Creating and Using Graphics.Point Instances
Source: https://github.com/iakuf/sciter.js-docs/blob/main/graphics/Point.md
Demonstrates various ways to construct Point objects and perform basic vector operations like addition and subtraction using operators.
```js
const position1 = Point(10,10);
const position2 = Point.make(20,20);
const position3 = Point(Rect(10,10,100,100)); // origin of the rect
// operators
const sum = Point(0,0) + Point(50,50);
const sub = Point(0,0) - Point(50,50); // [-50,-50]
```
--------------------------------
### Wrap Nodes with Element (Sciter.js)
Source: https://github.com/iakuf/sciter.js-docs/blob/main/DOM/Element/README.md
Wraps a specified range of DOM nodes, from a start node to an end node, into a new wrapper element. This operation is the inverse of `unwrapElement()`.
```APIDOC
element.wrapNodes(start:Node,end:Node,wrap:Element)
```