|
| 1 | +<img src="https://raw.githubusercontent.com/js-data/js-data/master/js-data.png" alt="js-data logo" title="js-data" align="right" width="96" height="96" /> |
| 2 | + |
| 3 | +# js-data-adapter |
| 4 | + |
| 5 | +[![Slack Status][sl_b]][sl_l] |
| 6 | +[![npm version][npm_b]][npm_l] |
| 7 | +[![npm downloads][dn_b]][dn_l] |
| 8 | + |
| 9 | +Base adapter class that all other js-data adapters extend. |
| 10 | + |
| 11 | +Refer to the various js-data adapter repositories to see how they extend |
| 12 | +`Adapter`. |
| 13 | + |
| 14 | +## Table of contents |
| 15 | + |
| 16 | +* [Quick start](#quick-start) |
| 17 | +* [Community](#community) |
| 18 | +* [Support](#support) |
| 19 | +* [Contributing](#contributing) |
| 20 | +* [License](#license) |
| 21 | + |
| 22 | +## Quick Start |
| 23 | + |
| 24 | +##### Browser-based adapter |
| 25 | +``` |
| 26 | +npm i --save js-data |
| 27 | +npm i --save-dev js-data-adapter |
| 28 | +``` |
| 29 | + |
| 30 | +##### Node.js based adapter |
| 31 | +``` |
| 32 | +npm i --save js-data js-data-adapter |
| 33 | +``` |
| 34 | + |
| 35 | +Now extend the adapter: |
| 36 | + |
| 37 | +```js |
| 38 | +// ES6 |
| 39 | +class MyAdapter extends Adapter {} |
| 40 | +``` |
| 41 | + |
| 42 | +```js |
| 43 | +// Use Adapter.extend |
| 44 | +var MyAdapter = Adapter.extend() |
| 45 | +``` |
| 46 | + |
| 47 | +```js |
| 48 | +// Manually extend |
| 49 | +function MyAdapter (opts) { |
| 50 | + Adapter.call(this, opts) |
| 51 | +} |
| 52 | + |
| 53 | +// Setup prototype inheritance from Adapter |
| 54 | +MyAdapter.prototype = Object.create(Adapter.prototype, { |
| 55 | + constructor: { |
| 56 | + value: MyAdapter, |
| 57 | + enumerable: false, |
| 58 | + writable: true, |
| 59 | + configurable: true |
| 60 | + } |
| 61 | +}) |
| 62 | + |
| 63 | +Object.defineProperty(MyAdapter, '__super__', { |
| 64 | + configurable: true, |
| 65 | + value: Adapter |
| 66 | +}) |
| 67 | +``` |
| 68 | +
|
| 69 | +
|
| 70 | +## Community |
| 71 | +
|
| 72 | +[Explore the Community](http://js-data.io/docs/community). |
| 73 | +
|
| 74 | +## Support |
| 75 | +
|
| 76 | +[Find out how to Get Support](http://js-data.io/docs/support). |
| 77 | +
|
| 78 | +## Contributing |
| 79 | +
|
| 80 | +[Read the Contributing Guide](http://js-data.io/docs/contributing). |
| 81 | +
|
| 82 | +## License |
| 83 | +
|
| 84 | +The MIT License (MIT) |
| 85 | +
|
| 86 | +Copyright (c) 2016 js-data-adapter project authors |
| 87 | +
|
| 88 | +* [LICENSE](https://github.com/js-data/js-data-adapter/blob/master/LICENSE) |
| 89 | +* [AUTHORS](https://github.com/js-data/js-data-adapter/blob/master/AUTHORS) |
| 90 | +* [CONTRIBUTORS](https://github.com/js-data/js-data-adapter/blob/master/CONTRIBUTORS) |
| 91 | +
|
| 92 | +[sl_b]: http://slack.js-data.io/badge.svg |
| 93 | +[sl_l]: http://slack.js-data.io |
| 94 | +[npm_b]: https://img.shields.io/npm/v/js-data-adapter.svg?style=flat |
| 95 | +[npm_l]: https://www.npmjs.org/package/js-data-adapter |
| 96 | +[dn_b]: https://img.shields.io/npm/dm/js-data-adapter.svg?style=flat |
| 97 | +[dn_l]: https://www.npmjs.org/package/js-data-adapter |
0 commit comments