Preface I would say that human history is a history of reinventing "wheels" of various kinds. This time we see concept of data binding reincarnated with slightly pathetic name Model-View-Controller. Of course, as many people as many meaning they give to the MVC abbreviation but, nevertheless, it is all around basic idea of data binding…
Category: Script
TIScript vs JavaScript.Harmony (ECMAScript 6), Part I
Variables, block scope As we know local variables in JavaScript are declared in function scope. That creates many problems and surprises for people who came to JS from other languages using the same Java/C/C++ notation. Consider sample that follows. Here we create array of 10 functions, each of them shall return idx value it was…
Promises/A+ implementation in Sciter2
The Promises, as a concept, is generalization of callback mechanism. This pattern is quite popular these days so Sciter2 SDK contains now (sdk/samples/+promise/) pretty simple (60 lines of code) implementation of the Promises. The promise is an object that: maintins list/chain of callback function pairs [onsuccess:function, onfailure:function] by providing .then(onsuccess, onfailure) method; promise object provides…
Q.tis – micro port of jQuery for Sciter.
I’ve published today Sciter 2.0.2.2 with q.tis – micro-port of essential jQuery features. Here is the list of supported functions. It is just enough to put include “t.tis”; in your code and any existing DOM function that returns array of elements will “automagically” produce the q-collection. In my implementation I am using the fact that…
Sciter 2.0.2.0 is out with new TIScript features
One of such features added in 2.0.2.0 is support of member variables declarations in classes. By using this var name = value construction you can define member (instance) variables: This code: class Foo { this var one = 1, // member variable two = 2; // member variable function sum() { return this.one + this.two;…
Making TIScript syntax compatible with CSS.
Time to time when I need to define some CSS constructs in script I feel myself non-comfortable – CSS and JavaScript/TIScript use different syntax’es. Consider this code in JavaScript: function switchState() { element.style.backgroundColor = “rgb(126,0,0)”; element.style.transform = “rotate(45deg) translate(10px,10px)”; } Not so aesthetically pleasing. And not so effective as string parsing is involved. And yet…
Use of CSS constants in script.
In Sciter you can define CSS constants using @const declarations like this: <style> @const TEST_STR:”test”; @const TEST_COLOR: rgb(128,0,0); @const TEST_NUMBER: 128; </style> and use them not only in CSS ( as @TEST_COLOR for example ) but also in script using accessor like this: var test_str = self.style.constant(“TEST_STR”); If you think that self.style.constant is too narrative…
TIScript, hidden treasures: for/in loop
Integer data type in TIScript is iteration-able, means the following works in TIScript: for(var i in 100) stdout.println(i); The code above will print numbers from 0 to 99 in stdout.
What does “::” construction mean in TIScript?
Got this question in one of emails… One of forms to declare anonymous function in TIScript is so called single statement lambda function: ‘:’ [param-list] ‘:’ <statement>; Let’s say we have this JavaScript code: var counter = 0; var inc = function() { counter++; } So each time when you call inc() the counter will…
JavaScript vs Dart/Chrome vs TIScript/Sciter
Here is a comparison table of JavaScript/jQuery, Dart/GoogleChrome and TIScript/Sciter: www.terrainformatica.com/sciter/js-dart-tis.htm. It tries to compare similar features among these three technologies. My TIScript looks pretty good if you would ask me. Not that extreme as Dart and close to original JavaScript while bringing needed modularity and convenience. The document is based on synonym.dartlang.org , if…