Using the Indexer Helper

When you add a new note to the My Notes app, you also must update the Windows Index so that it can index the new note. I’ve modified the code used to handle adding a new note so the note also gets added to the index (see Listing 13.10).

LISTING 13.10 Adding a Note to the Index (\pages\add\add.js)

document.getElementById("frmAdd").addEventListener("submit", function (e) {    e.preventDefault();    // Save new note and navigate home    MyApp.notesDataSource.insertAtEnd(null, {        title: document.getElementById("inpTitle").value,        contents: toStaticHTML(document.getElementById("inpContents").innerHTML),        comments: ""    }).then(function (newItem) {        return Indexer.add(newItem.key, ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.