Skip to content

QARequire

Katherine ChengLi edited this page Apr 6, 2015 · 1 revision

Introduction

Large applications often require a number of JavaScript files. Generally, they are loaded one by one using script tags. Additionally, each file can potentially be dependent on other files.

The basic functionality of require is that it reads a javascript file, executes the file, and then proceeds to return the exports object.

An example require function which is being used for our Sample App looks like this:

require(['dom/navControl','dom/form/date','dom/form/select'],

This function here calls the controls we want to use in our application from the quickforms library. For example, considering the above controls navControl is used to add navigation to your page where you can define the tabs for your navigation bar. The date control would allow you to add a date or time picker to your form. The select control is to select any option from a dropdown list of options provided.

Note: The require function goes hand in hand with the controls or elements you would like to add to your application.

Clone this wiki locally