Changes
Page history
thimo created page: custom plugins
authored
Nov 26, 2017
by
Thimo Kraemer
Show whitespace changes
Inline
Side-by-side
custom-plugins.md
0 → 100644
View page @
3150e92a
KSS has a plugin architecture. Apart from the core that is
parsing the .kss files and binding them to nodes, communicating
with the server and executing the KSS commands, almost every
component, incuding actions, events, parameter providers,
selectors is designed to be pluggable.
The KSS plugin API makes it possible to create all these
components and register them to KSS.
The plugin development is a seldom needed and specialized task.
To be able to do it, you must be familiar with Javascript and
KSS.
Creating an action
==================
An action is a Javascript function that is called when the action
is executed. It receives the node and a parameter object::
```
js
kss
.
registerActionProvider
(
'
replaceInnerHTML
'
,
function
(
node
,
params
)
{
node
.
innerHTML
=
params
.
html
;
});
```
Creating a parameter provider
=============================
A parameter provider is a Javascript function that is called for each
parameter for an action. It receives the node and all arguments::
```
js
kss
.
registerParameterProvider
(
'
nodeAttr
'
,
function
(
node
,
name
)
{
return
node
.
getAttribute
(
name
);
});
```
Creating a custom event binder
==============================
TODO