forked from algolia/instantsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.es6.js
36 lines (30 loc) · 1.18 KB
/
index.es6.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* eslint max-len: 0 */
import algoliasearchHelper from 'algoliasearch-helper';
import toFactory from 'to-factory';
/* eslint-disable import/no-unresolved */
import InstantSearch from './lib/InstantSearch.js';
import version from './lib/version.js';
/* eslint-enable import/no-unresolved */
// import instantsearch from 'instantsearch.js';
// -> provides instantsearch object without connectors and widgets
const instantSearchFactory = toFactory(InstantSearch);
instantSearchFactory.version = version;
instantSearchFactory.createQueryString =
algoliasearchHelper.url.getQueryStringFromState;
Object.defineProperty(instantSearchFactory, 'widgets', {
get() {
throw new ReferenceError(
`You can't access 'instantsearch.widgets' directly from the ES6 build.
Import the widgets this way: 'import {SearchBox} from "instantsearch.js/es/widgets"'`
);
},
});
Object.defineProperty(instantSearchFactory, 'connectors', {
get() {
throw new ReferenceError(
`You can't access 'instantsearch.connectors' directly from the ES6 build.
Import the connectors this way: 'import {connectSearchBox} from "instantsearch.js/es/connectors"'`
);
},
});
export default instantSearchFactory;