ScIDE is a compact and handy source code editor with syntax highlighting (colorizing). ScIDE is a system of HTML, CSS and scripting files that are running inside the Sciter. So ScIDE is so-called .scapp – Sciter application. You can run ScIDE: inside Sciter.exe player (part of main SDK distribution) or as a separate application ScIDE.exe…
Category: Script
JavaScript. Private members (instance variables).
As you know JavaScript has no concept of private members in objects. Objects there are “racks of properties” that anyone can change. Here is a simple way of making “objects” in JS that have private instance variables. Such variables can be changed only by [public] methods you provide. Consider following code: function CreateMyObject() { var…
Sciter. Working with persistent data (database)
Here is an example of minimalistic application working with DB (persistent data) in Sciter. This sample is using three files: simple-db-form.htm – main file of our application; db.tis – open or create database; form.tis – behavior that handles showing/saving data from list of input elements on the form. db.tis – open or create database This…
Generator functions in Sciter and tiscript.
Generator function is a function that produce sequence of values. Each call of such function returns next value of some sequence. Here is one possible implementation of generator function that can be used in Sciter. Idea of this implementation is borrowed from LUA programming language. Let’s say we would like to enumerate some array in…
JavaScript functions, named parameters.
JavaScript does not support named parameters. For example following will not work in JS: var something = foo( one: 1, two: “2” ); As a workaround people use functions that accept single parameter – object reference: var something = foo( { one: 1, two: “2” } ); but I think such notation is not good…
Aesthetically scripting.
Say you have some html document that has some elements with assigned IDs. I would like to find better notation for functions – event handlers in TIScript. For example we have following html fragment: <button id=”foo”>Click me!</button> and we know that such button can generate onClick event (whatever it means). There are multiple possible ways…
JavaScript closures
Found excellent article of Richard Cornford: Javascript Closures BTW: All principles there apply to TIScript too.
Eclectic-pencil about Sciter
Robert Shiplett have made sketch by his eclectic-pencil of Sciter, TIScript, DyBase and JSON.
Sciter: How to get list of all selected options in < select multiple >?
Following code fragment will fill array a with selected < option> references in multiselectable list ( sel – reference to some < select multiple > ) var a = []; sel.select ( :el: a.push(el), “option:checked” ); This fragment uses following: Element.select(callback-function, css-selector) method of the DOM element. (a.k.a. getElementsBySelector()) Short form of lambda function notation…
Try/catch/finally extravaganza #3
return in finally sections is a bad idea: function foo() { try { try { return 1/0; } catch(e) { return 2; } finally { return 3; } } catch(e) { return 4; } finally { return 5; } } Probably return allowance in finally sections is a design flaw of JavaScript language itself?