4 ms·
Just in case, architecture of components in Sciter. Could be interesting for some. Assignment and composition - by CSS, and only by CSS, Sciter's specific prot
by c-smile 10y ago
Just in case, architecture of components in Sciter. Could be interesting for some.
Assignment and composition - by CSS, and only by CSS, Sciter's specific prototype property:
.myComponent {
prototype: MyComponent url(components/my.tis);
color: red;
...
}
where MyComponent is the name of script class in components/my.tis script file. That MyComponent looks like as
class MyComponent : Element
{
function attached() {
// called when DOM element gets this class
// a.k.a. DOM constructor
// content initialization, if needed:
this.$content( <button.prev/>
<button.next/> );
}
function detached() {
// called when DOM element looses this class
// a.k.a. DOM destructor
}
function method() {
// some public method
}
property prop(v) {
// some public property
get { ... }
set { ... }
}
event mousedown (evt) {
// default mousedown event handler
}
event mouseup (evt) {
// default mouseup event handler
}
event click $(button.next) {
// click on its button.next
}
event click $(button.prev) {
// click on its button.prev
}
// etc
}
To use such component:
1. include CSS where the binding is defined (prototype above)
2. In markup to define matching element:
<div.myComponent />
Nothing too complicated and pretty effective. Could be done even 18 years ago: http://www.w3.org/TR/1999/WD-becss-19990804#behavior http://www.w3.org/TR/1999/WD-becss-19990804#behavior
- dmitriid 10y agoYeah. Sciter's ideas would be awesome :(