ForgejComponent
en

jComponent

Dispatch custom path flags with FLAGS

jComponent 20 · jcomponent@20 jcomponentflagseventspaths Executed with jComponent 20

FLAGS('path @name', callback) parses a jComponent path, emits @flag name with the parsed path and invokes the callback. Register the listener with ON('@flag name', function(path) { ... }). Multiple distinct custom flags emit separate events; repeating a name in the same expression emits it once. In this example, execution and the callback are synchronous.

The parsed path is the event argument. A value such as @refresh:yes still selects the flag named refresh; the value is not passed as a second event argument. Reserved flags such as @reset are excluded from these custom events. Calling FLAGS() alone does not call SET() or reset component state: state operations interpret their own flags. Use application-specific flag names to avoid collisions.

public/index.html
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>Custom flags</title>
<script src="//cdn.componentator.com/spa.min@20.js"></script></head>
<body><p>Dispatch a custom refresh notification without modifying the model.</p></body></html>
Try it in your browser

Edit the example and run it. It runs in an isolated frame in your browser; nothing is sent to our server.

Preview