Skip to content

YngwieMVC.View

mastergray edited this page Sep 19, 2021 · 2 revisions

Class that implements a "view" for abstracting elements of a client-side user interface.

Properties

Property Type Description
_elem yngwieElement yngwieElement of view
_fns [yngwieElement -> yngwieElement] Functions that are applied to yngwieElement of view when view is rendered
_node ELEMENT Stores reference to rendered view
_children [yngwieView] Child views of this view

CONSTRUCTOR :: yngwieElement|VOID -> yngwieView

Creates instance of yngwieView with the given yngwieElement stored as it's element.

yngwieView.elem :: VOID|yngwieElement|STRING, STRING, OBJECT, STRING, [yngwieListener] -> yngwieElement|yngwieView|yngwieView

Setter/getter method for yngwieElement stored by view. Getting the yngiweElement stored by view will apply every stored "modifier" function to that yngwieElement.

yngwieView.modify :: (yngwieElement -> yngwieElement) -> yngwieView

Adds function to apply to yngwieElement when view is retrieved or rendered.

yngwieView.on :: STRING, (EVENT, NODE -> VOID) -> yngwieView

Initializes yngwieListener for yngwieElement stored by view.

yngwieView.text :: STRING -> this

Modifies element of view to show given text.

yngwieView.append :: yngwieView -> yngwieView

Appends another yngwieView to this view. Throws a yngwieError exception if given argument is not a yngwieView.

yngwieView.appends :: [yngwieView] -> yngwieView

Appends an array of yngwieViews to this view. Throws a yngwieError exception if given argument is not an ARRAY.

yngwieView.render :: STRING|ELEMENT|VOID, OBJECT|VOID -> ELEMENT

Creates and returns rendered ELEMENT from view, storing result of render.

yngwieView.renderAgain :: VOID -> ELEMENT

Re-renders view using stored node. If no node has been stored, then a yngwieError is thrown.

yngwieView.inject :: STRING|NODE, OBJECT|VOID -> ELEMENT

Empties content of given target and appends it with rendered node.

YngwieView.init :: yngwieElement|STRING, STRING, OBJECT, STRING, [yngwieListener] -> yngwieView

Static factory method for YngwieView.

YngwieView.is :: * -> BOOLEAN

Return TRUE if given value is an instance of YngwieView.

YngwieView.setAsNode :: STRING|ELEMENT|VOID, DOCUMENT|VOID -> ELEMENT|DOCUMENTFRAGMENT

Returns NODE for given target and context. Throw yngwieError exception if value cannot be set as NODE.

YngwieView.render :: yngwieView, STRING|ELEMENT|VOID, DOCUMENT|VOID -> ELEMENT

Renders given view and all of it children using given target and context.