Concrete subclasses should fill this in with the actual guts of the Gadget.
Concrete subclasses should fill this in with the actual guts of the Gadget.
Note that this can be filled with a conventional Scalatags TypedTag thanks to an implicit conversion in globals.
We intercept applyTo() (which is part of Scalatags), to record the parent of this Node.
We intercept applyTo() (which is part of Scalatags), to record the parent of this Node.
Concrete classes must define this.
Concrete classes must define this. It causes the actual DOM node to come into existence.
Fetches the actual rendered DOM Node for this Frag.
Fetches the actual rendered DOM Node for this Frag.
IMPORTANT: this is convenient, but fundamentally unsafe! Only use it in places where you are *certain* that the Node has already been rendered; otherwise, use the safer elemOpt or elemOptRx!
An Rx member containing the actual Node iff it has been rendered.
An Rx member containing the actual Node iff it has been rendered.
Convenience function for operating on the Element, if this Gadget has been rendered.
Convenience function for operating on the Element, if this Gadget has been rendered.
Yes, this deliberately squashes Output to Element for purposes of the function call. That is typically good enough, and is kinder to the sQuery type inference.
TBD: this suggests that sQuery should be smarter about Element subclasses.
Concrete Gadgets can override this to perform actions after we've created the actual Element.
This is called immediately after this fragment is inserted into its parent, so that you can provide additional stuff that happens then.
This is called immediately after this fragment is inserted into its parent, so that you can provide additional stuff that happens then.
Subclasses can override this to define behaviour that happens in the middle of the render function.
Subclasses can override this to define behaviour that happens in the middle of the render function. Generally used by infrastructure, not concrete classes.
The parent of the resulting Node, once it has been created.
The parent of the resulting Node, once it has been created.
We intercept render (which is part of Scalatags), to record the Node when it gets created, and to provide access to the creation event.
We intercept render (which is part of Scalatags), to record the Node when it gets created, and to provide access to the creation event.
IMPORTANT: this imperatively renders the Gadget; if you call it repeatedly, it will render again! Use rendered by preference most of the time.
Lazy version of render().
Lazy version of render(). This returns the rendered content of the Gadget, rendering if need be. This allows you to easily fetch the elem repeatedly, without worrying about re-rendering.
Slam the element for this Gadget.
Slam the element for this Gadget. You should only call this iff the element was created from an external mechanism and you're building this Gadget around that element.
This is intentionally designed for chaining, for ease of use -- it returns this Gadget.
Wrapper around Scalatags, to provide support for tracking and updating the rendered elements as the underlying data changes.
If you need complex behaviour, subclass this and extend it. If you just need to be able to access the DOM created by the rendered Scalatags, just use the Gadget(scalatags) entry point.