|
1 | 1 | /* global fetch:true Headers:true Request:true */ |
2 | 2 |
|
3 | | -/** |
4 | | - * Registered as `js-data-http` in NPM and Bower. The build of `js-data-http` |
5 | | - * that works on Node.js is registered in NPM as `js-data-http-node`. The build |
6 | | - * of `js-data-http` that does not bundle `axios` is registered in NPM and Bower |
7 | | - * as `js-data-fetch`. |
8 | | - * |
9 | | - * __Script tag__: |
10 | | - * ```javascript |
11 | | - * window.HttpAdapter |
12 | | - * ``` |
13 | | - * __CommonJS__: |
14 | | - * ```javascript |
15 | | - * var HttpAdapter = require('js-data-http') |
16 | | - * ``` |
17 | | - * __ES6 Modules__: |
18 | | - * ```javascript |
19 | | - * import HttpAdapter from 'js-data-http' |
20 | | - * ``` |
21 | | - * __AMD__: |
22 | | - * ```javascript |
23 | | - * define('myApp', ['js-data-http'], function (HttpAdapter) { ... }) |
24 | | - * ``` |
25 | | - * |
26 | | - * @module js-data-http |
27 | | - */ |
28 | | - |
29 | 3 | const axios = require('axios') |
30 | 4 | import {utils} from 'js-data' |
31 | 5 | import { |
@@ -183,40 +157,16 @@ Object.defineProperty(HttpAdapter, '__super__', { |
183 | 157 | /** |
184 | 158 | * Alternative to ES6 class syntax for extending `HttpAdapter`. |
185 | 159 | * |
186 | | - * __ES6__: |
187 | | - * ```javascript |
188 | | - * class MyHttpAdapter extends HttpAdapter { |
189 | | - * deserialize (Model, data, opts) { |
190 | | - * const data = super.deserialize(Model, data, opts) |
191 | | - * data.foo = 'bar' |
192 | | - * return data |
193 | | - * } |
194 | | - * } |
195 | | - * ``` |
| 160 | + * @example <caption>Using the ES2015 class syntax.</caption> |
| 161 | + * class MyHttpAdapter extends HttpAdapter {...} |
| 162 | + * const adapter = new MyHttpAdapter() |
196 | 163 | * |
197 | | - * __ES5__: |
198 | | - * ```javascript |
199 | | - * var instanceProps = { |
200 | | - * // override deserialize |
201 | | - * deserialize: function (Model, data, opts) { |
202 | | - * var Ctor = this.constructor |
203 | | - * var superDeserialize = (Ctor.__super__ || Object.getPrototypeOf(Ctor)).deserialize |
204 | | - * // call the super deserialize |
205 | | - * var data = superDeserialize(Model, data, opts) |
206 | | - * data.foo = 'bar' |
207 | | - * return data |
208 | | - * }, |
209 | | - * say: function () { return 'hi' } |
210 | | - * } |
211 | | - * var classProps = { |
212 | | - * yell: function () { return 'HI' } |
213 | | - * } |
| 164 | + * @example <caption>Using {@link HttpAdapter.extend}.</caption> |
| 165 | + * var instanceProps = {...} |
| 166 | + * var classProps = {...} |
214 | 167 | * |
215 | 168 | * var MyHttpAdapter = HttpAdapter.extend(instanceProps, classProps) |
216 | 169 | * var adapter = new MyHttpAdapter() |
217 | | - * adapter.say() // "hi" |
218 | | - * MyHttpAdapter.yell() // "HI" |
219 | | - * ``` |
220 | 170 | * |
221 | 171 | * @name HttpAdapter.extend |
222 | 172 | * @method |
@@ -1254,3 +1204,30 @@ exports.addActions = function addActions (opts) { |
1254 | 1204 | * otherwise `false` if the current version is not beta. |
1255 | 1205 | */ |
1256 | 1206 | exports.version = '<%= version %>' |
| 1207 | + |
| 1208 | +/** |
| 1209 | + * Registered as `js-data-http` in NPM and Bower. The build of `js-data-http` |
| 1210 | + * that works on Node.js is registered in NPM as `js-data-http-node`. The build |
| 1211 | + * of `js-data-http` that does not bundle `axios` is registered in NPM and Bower |
| 1212 | + * as `js-data-fetch`. |
| 1213 | + * |
| 1214 | + * __Script tag__: |
| 1215 | + * ```javascript |
| 1216 | + * window.HttpAdapter |
| 1217 | + * ``` |
| 1218 | + * __CommonJS__: |
| 1219 | + * ```javascript |
| 1220 | + * var HttpAdapter = require('js-data-http') |
| 1221 | + * ``` |
| 1222 | + * __ES6 Modules__: |
| 1223 | + * ```javascript |
| 1224 | + * import HttpAdapter from 'js-data-http' |
| 1225 | + * ``` |
| 1226 | + * __AMD__: |
| 1227 | + * ```javascript |
| 1228 | + * define('myApp', ['js-data-http'], function (HttpAdapter) { ... }) |
| 1229 | + * ``` |
| 1230 | + * |
| 1231 | + * @module js-data-http |
| 1232 | + */ |
| 1233 | +exports.default = HttpAdapter |
0 commit comments