Creating Custom Data Sources

Let me start by giving you an overview of how you can create a custom data source. In this section, I’ll explain how you can implement the methods of a custom data source that uses a JavaScript array to store data. I’ll walk through creating the constructor for this data source as well as the most important methods for this data source. After discussing this (overly simple) data source in this section, we’ll dive into building more practical data sources in latter sections, such as the Web service data source and IndexedDB data source.

Note

You can find the entire source code for the custom data source discussed in this section in the myData\myDataSource.js file.

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.