Access modifiers are special keywords which can be used to control the visibility and accessibility of component arguments.

Types of Access Modifiers

fastn provides two types of access modifiers which can be used with component arguments. If not specified, then the default visibility is public for all arguments defined under component definition.
  • public (Default): This ensures that the arguments can be accessed from anywhere.
  • private: This ensures that the argument can only be accessed from within the component.

How to use them ?

To use any access modifier, you simply need to specify it while defining component argument during component definition.
Using access modifier
-- component foo:
caption name:
private boolean mouse-hovered: false

-- ftd.text: $
color: red
color if { foo.mouse-hovered }: green
$on-mouse-enter$: $ftd.set-bool($a = $foo.mouse-hovered, v = true)
$on-mouse-leave$: $ftd.set-bool($a = $foo.mouse-hovered, v = false)

-- end: foo

Here, we have defined a simple component foo. This component is using ftd.text, a kernel component, as a definition which displays the caption name.

It has a private boolean argument mouse-hovered which can be only accessed from within the component itself. So while component invocation, we can’t access this mouse-hovered argument.
Invalid component invocation
;; This should not be done
-- foo: xyz
$mouse-hovered: false

Support fastn!

Enjoying fastn? Please consider giving us a star ⭐️ on GitHub to show your support!

Getting Help

Have a question or need help?

Visit our GitHub Q&A discussion to get answers and subscribe to it to stay tuned.

Join our Discord channel and share your thoughts, suggestion, question etc.

Connect with our community!

Found an issue?

If you find some issue, please visit our GitHub issues to tell us about it.

Join us

We welcome you to join our Discord community today.

We are trying to create the language for human beings and we do not believe it would be possible without your support. We would love to hear from you.
Copyright Β© 2023 -