PShowcase
EN NL
09 / 20

The apply() protocol

The server returns DOM commands and phlo.js applies them.

.phlo
// the server returns DOM commands; phlo.js applies them.
apply(inner:  ['#box' => $html])        // replace innerHTML
apply(append: ['#box' => $row])         // add a child
apply(class:  ['#box' => '!is-flash'])  // toggle a class
apply(attr:   ['#box' => ['data-state' => 'active']])

// a missing target fails silently. no build step checks the keys.

Click a command above.