Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 1.58 KB

BOOTSTRAP.md

File metadata and controls

19 lines (12 loc) · 1.58 KB

hackmd-github-sync-badge

Bootstrapping Qwik

Qwik is designed to have the smallest amount of code which needs to be run on the client to bootstrap the application. The size of bootstrap code has direct impact on application time to interactive.

The bootstrapping code is known as qwikloader and is tiny (around 500 bytes minified.) and can bootstrap in under one millisecond. The purpose of qwikloader is to set up global browser event listeners for your application, such as click event. If an event fires, the qwikloader looks for a corresponding on:click attribute which contains a QRL. The QRL tells qwikloader from where the event handler for the click event should be downloaded.

Bootstrapping

To bootstrap a Qwik application one needs to insert this into the page:

<script src="/qwikloader.min.js" async events="click;dblclick;keyup"></script>
  • src: points to the location where the qwikloader.js can be found.
  • async: Tells the browser that it is not necessary to wait for the qwikloader to load and execute before continuing to parse the HTML. The application will work without this, but adding async will slightly improve the startup time.
  • events: An optional list of events which the qwikloader should listen too. If the list is not provided the qwikloader will listen to all of the browser events. While this may be convenient, it will result in longer bootstrap times. Listing the events is strongly preferred.