The KiTE – template engine for JavaScript

Preface Modern Web applications frequently use AJAX kind of client/server interaction. They receive data from the server in pure JSON format. That means instead of generating markup on the server such applications are composing HTML inside the browser (on client side). Straightforward approach is to use string concatenation spagetti like : "<b>" + data +…

Behaviors, simple jQuery extension.

Behaviors as an entity is a declarative way to assign/bind scripting methods to DOM elements. We can think that browsers have following declarations in their default CSS declarations: input[type=text] { binding: TextEditorImpl; } input[type=button] { binding: ButtonImpl; } select { binding: SelectImpl; } … So when we define <input type="text" /> in our markup we…

TIScript: classes, decorators and events.

One of differences of TIScript from JavaScript is that it has classes and namespaces. Declaration of a class in source code looks like this: class Baz { function foo() { … } property bar(v) { … } // … other functions, properties, variables, // constants and decorator calls … } As you see class declartion…

Multi-return and multi-assignment in TIScript.

As we know parameters of functions are passed by value in languages like TIScript and JavaScript. Inside the function we can modify paramaters and their new values will not be seen outside the function. Let’s say we need to implement function expand(rect, dx, dy) : rect that should increase dimensions of the rectangle. If the…

Stringizer functions in TIScript

Motivation. Tasks of defining string expressions and textual fragments in script code are pretty common. Typical example in JS/browser is: someelement.innerHTML = "<span style=\"color:#ffffff\">" + somestuff + "</span>"; As you see this could be quite noisy and complex to be comprehensible by human. Various scripting languages are trying to reduce syntax noise in various ways….

Achtung, minen!

One more “cool” thing about JS: somevar = 100; function test() { somevar = 1; return somevar; if(false) { var somevar; } } alert(test()); alert(somevar); Try to guess first what these two alert()s will output in JS. You did? Then try to see this code running alive: js-mine. That is what Web2 is supposed to…

TIScript vs. JavaScript

I have published article comparing TIScript and JavaScript on CodeProject. That is a “big picture” if you wish. I have written this article completely in the ScApp (Sciter Application) named BlockNote for the Net: It is a part of Sciter SDK and reside in sdk/scapps/blocknote.net/ folder. Eventually this will replace outdated BlockNote v.1.8 application. Plan…

Decorators in TIScript, fun of UI programming is back.

Latest builds of the Sciter have decorators implemented. My implementation of decorators ideologically derived from the same decorator feature in Python of Guido van Rossum. Decorators is a meta/macro-programming feature that allows to transform or update function or class defined in source code. Here is an example: say we are designing some dialog with various…

UI programming you said?

Usually business applications are split in three tiers: user interface layer (UI), business logic layer (BLL) and data access layer (DAL). That split is also known as Model-view-controller architectural pattern. Ideally each layer should be isolated from the rest. For many good reasons. In any case each layer operates using its own vocabulary (namespace if…