Schema and guidelines for creating a staticSearch engine for your HTML5 site
Martin Holmes
Joey Takeda
2019–2026

This documentation provides instructions on how to use the Project Endings staticSearch Generator to provide a fully-functional search ‘engine’ to your website without any dependency on server-side code such as a database.

11 Programming with staticSearch

If you are a programmer, you may want to write your own code to interact with staticSearch in some way. To make it easier to work with the JavaScript that runs on the search page, the StaticSearch object dispatches a number of CustomEvents which you can listen for in your own code. These are the events:

You can use these events in your code in the following way:

var showMessage = function(){ alert('The StaticSearch instance has been constructed!'); } window.addEventListener('ssInstantiated', showMessage); 

In the case of the ssSearchCompleted event, you could do this:

var showMessage = function(evt){ alert(evt.detail.hits + ' documents found!'); } window.addEventListener('ssSearchCompleted', showMessage); 
Martin Holmes and Joey Takeda. Date: 2019–2026