docs: update, re-added debounce
This commit is contained in:
		
							parent
							
								
									b10b23a47b
								
							
						
					
					
						commit
						8fc6b8e28e
					
				
					 2 changed files with 11 additions and 3 deletions
				
			
		| 
						 | 
					@ -15,7 +15,15 @@ async function searchContents(query) {
 | 
				
			||||||
  return (await response.json());
 | 
					  return (await response.json());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
registerHandlers((e) => {
 | 
					function debounce(func, timeout = 200) {
 | 
				
			||||||
 | 
					  let timer;
 | 
				
			||||||
 | 
					  return (...args) => {
 | 
				
			||||||
 | 
					    clearTimeout(timer)
 | 
				
			||||||
 | 
					    timer = setTimeout(() => { func.apply(this, args); }, timeout)
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					registerHandlers(debounce((e) => {
 | 
				
			||||||
  term = e.target.value
 | 
					  term = e.target.value
 | 
				
			||||||
  if (term !== "") {
 | 
					  if (term !== "") {
 | 
				
			||||||
    searchContents(term)
 | 
					    searchContents(term)
 | 
				
			||||||
| 
						 | 
					@ -27,4 +35,4 @@ registerHandlers((e) => {
 | 
				
			||||||
      ))
 | 
					      ))
 | 
				
			||||||
      .then(results => displayResults(results))
 | 
					      .then(results => displayResults(results))
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
})
 | 
					}))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,4 +47,4 @@ operandApiKey: "0e733a7f-9b9c-48c6-9691-b54fa1c8b910"
 | 
				
			||||||
	3. Set the 'Repository Ref' to `master`
 | 
						3. Set the 'Repository Ref' to `master`
 | 
				
			||||||
	4. Set the 'Repository Name' to the name of your repository (usually just `quartz` if you forked the repository without changing the name)
 | 
						4. Set the 'Repository Name' to the name of your repository (usually just `quartz` if you forked the repository without changing the name)
 | 
				
			||||||
	5. Leave 'Root Path' and 'Root URL' empty
 | 
						5. Leave 'Root Path' and 'Root URL' empty
 | 
				
			||||||
9. Wait for your repository to index and enjoy natural language search in Quartz!
 | 
					9. Wait for your repository to index and enjoy natural language search in Quartz! Operand refreshes the index every 2h so all you need to do is just push to GitHub to update the contents in the search.
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue