Skip to content

Embebed methods

The <script type="methods"> tag allow loading functions into the Graphane component. You can include functions in the code, and these functions are available into the template.

In this example, we define a change() function and use the function in the template as handler for the event click. When the user clicks, the label is changed.

Only the named functions are translated to the template environment. Constants, variables, arrow function or anonymous functions are not linked to the template.

Into the methods code $ is a reference to the Graphane template component. As a result, you can access to the $.svg element or the $.data object.

WARNING

In some environments the <script type="methods"></script> has conflicts. In these cases, you can use alternatively <g-script type="methods"></g-script>.

Released under the MIT License.