bond:load This attribute is used to declare that an activity must be called as soon as the page loads. This also
means that a request will be sent immediately a page is loaded.
bond:click This attribute declares that an activity must be called only when an element is clicked upon.
bond:mouseover This attribute declares that an activity must be called only when an element is hovered upon. This
may generated a continuous request.
bond:keypress This attribute declares that an activity must be called only when a key is pressed down while on an input field.
bond:load directive in the bond
component
bond('Posts')
<?php
namespace spoova/mi/windows/Bond;
use spoova/mi/core/classes/Bond;
class Posts extends Bond{
public function render(): Compiler|String {
return compile('bond-template');
}
public function activity() {
//do something
}
}
<div>
<button bond:load="activity"> Run Activity <button>
</div>
bond('Posts')
loads, a request is immediately forwarded which calls the activity() method of the component
controller. Once the activity is executed, then the live component is re-rendered back to the page. Any method
can be called in this way but the method must not be a private, protected or static method. All other
event attributes can be used similarly to trigger the re-rendering of a bond componenet.