| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8"> |
| <title>JSDoc: Source: store.js</title> |
| |
| <script src="scripts/prettify/prettify.js"> </script> |
| <script src="scripts/prettify/lang-css.js"> </script> |
| <!--[if lt IE 9]> |
| <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> |
| <![endif]--> |
| <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> |
| <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> |
| </head> |
| |
| <body> |
| |
| <div id="main"> |
| |
| <h1 class="page-title">Source: store.js</h1> |
| |
| |
| |
| |
| |
| <section> |
| <article> |
| <pre class="prettyprint source"><code>/*
|
| * Licensed to the Apache Software Foundation (ASF) under one
|
| * or more contributor license agreements. See the NOTICE file
|
| * distributed with this work for additional information
|
| * regarding copyright ownership. The ASF licenses this file
|
| * to you under the Apache License, Version 2.0 (the
|
| * "License"); you may not use this file except in compliance
|
| * with the License. You may obtain a copy of the License at
|
| *
|
| * http://www.apache.org/licenses/LICENSE-2.0
|
| *
|
| * Unless required by applicable law or agreed to in writing,
|
| * software distributed under the License is distributed on an
|
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| * KIND, either express or implied. See the License for the
|
| * specific language governing permissions and limitations
|
| * under the License.
|
| */
|
| //'use strict';
|
|
|
| /** @module store */
|
|
|
|
|
|
|
|
|
|
|
| exports.defaultStoreMechanism = "best";
|
|
|
| /** Creates a new store object.
|
| * @param {String} name - Store name.
|
| * @param {String} [mechanism] -
|
| * @returns {Object} Store object.
|
| */
|
| exports.createStore = function (name, mechanism) {
|
|
|
|
|
| if (!mechanism) {
|
| mechanism = exports.defaultStoreMechanism;
|
| }
|
|
|
| if (mechanism === "best") {
|
| mechanism = (DomStore.isSupported()) ? "dom" : "memory";
|
| }
|
|
|
| var factory = mechanisms[mechanism];
|
| if (factory) {
|
| return factory.create(name);
|
| }
|
|
|
| throw { message: "Failed to create store", name: name, mechanism: mechanism };
|
| };
|
|
|
| exports.DomStore = DomStore = require('./store/dom.js');
|
| exports.IndexedDBStore = IndexedDBStore = require('./store/indexeddb.js');
|
| exports.MemoryStore = MemoryStore = require('./store/memory.js');
|
|
|
| var mechanisms = {
|
| indexeddb: IndexedDBStore,
|
| dom: DomStore,
|
| memory: MemoryStore
|
| };
|
|
|
| exports.mechanisms = mechanisms;
|
|
|
|
|
|
|
|
|
| </code></pre> |
| </article> |
| </section> |
| |
| |
| |
| |
| </div> |
| |
| <nav> |
| <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils.html">odata/utils</a></li><li><a href="deferred.html">odatajs/deferred</a></li><li><a href="utils_.html">odatajs/utils</a></li><li><a href="xml.html">odatajs/xml</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a href="DjsDeferred.html">DjsDeferred</a></li><li><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3> |
| </nav> |
| |
| <br clear="both"> |
| |
| <footer> |
| Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Thu Apr 09 2015 08:31:26 GMT+0200 (MESZ) |
| </footer> |
| |
| <script> prettyPrint(); </script> |
| <script src="scripts/linenumber.js"> </script> |
| </body> |
| </html> |