Pusa 2.0

server-driven declarative UI engine

Hello world

This small example demonstrates Pusa’s ability to work only with backend code.

<button id="helloworld"> Click me </button>
/* Pusa SDK */ $this -> action /* define new action */ ( 'helloworld-click', /* id of action */ [ $this -> copy() /* create a branch of directives*/ -> alert( 'Hello World' ) /* directive for action */ ] ) -> body() /* focus on DOM body */ -> childrenById( 'helloworld' ) /* find helloworld element */ -> event( 'click', 'helloworld-click' ); /* set action on click */
/* no custom js */

Pusa uses a declarative format of directives that are generated during backend method execution.

[ [ "action", "helloworld-click", [ [ "alert", "Hello world" ] ] ], [ "body" ], [ "children", [ "equal", "#id", "helloworld" ] ], [ "event", "click", "helloworld-click" ] ]

Thus, the development of the active part of the frontend application has been moved to the backend.

Pusa Catlair 2009-2025 still@itserv.ru wiki.ru opennet.net