Verse Library verse

01 Fragment

Shows correct device instantiation and event binding. Use for interactive button logic.

verse-library/verse-the-important-rules/01-fragment.verse

# WRONG — these names don't exist; invented out of thin air
MyButton : magic_button_device = magic_button_device{}
MyButton.WhenClicked.Listen(DoStuff)

# RIGHT — real device, real event, real method
MyButton : button_device = button_device{}
MyButton.InteractedWithEvent.Subscribe(OnPressed)

Comments

    Sign in to vote, comment, or suggest an edit. Sign in