Created
August 25, 2017 13:16
-
-
Save Chiamaka/f879a87f3f300ff343b145eabf5c9e0c to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/ceweyozibi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
'use strict'; | |
Object.defineProperty(exports, '__esModule', { | |
value: true | |
}); | |
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | |
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | |
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | |
var _react = require('react'); | |
var _react2 = _interopRequireDefault(_react); | |
var _reactNative = require('react-native'); | |
var _algoliasearchReactnative = require('algoliasearch/reactnative'); | |
var _algoliasearchReactnative2 = _interopRequireDefault(_algoliasearchReactnative); | |
var queries = [{ | |
indexName: 'prod_shows', | |
query: 'Accra', | |
params: { | |
hitsPerPage: '10', | |
page: '0', | |
attributesToRetrieve: '*', | |
facets: '["country"]', | |
facetFilters: '[["country:GH"]]' | |
} | |
}, { | |
indexName: 'prod_stations', | |
query: 'Accra', | |
params: { | |
hitsPerPage: '10', | |
page: '0', | |
attributesToRetrieve: '*', | |
facets: '["country"]', | |
facetFilters: '[["country:GH"]]' | |
} | |
}]; | |
var sandbox = (function (_Component) { | |
_inherits(sandbox, _Component); | |
function sandbox(props) { | |
_classCallCheck(this, sandbox); | |
_get(Object.getPrototypeOf(sandbox.prototype), 'constructor', this).call(this, props); | |
this.client = (0, _algoliasearchReactnative2['default'])(APP_ID, API_KEY); | |
} | |
_createClass(sandbox, [{ | |
key: 'componentDidMount', | |
value: function componentDidMount() { | |
this.client.search(queries, this.handleSearch); | |
} | |
}, { | |
key: 'handleSearch', | |
value: function handleSearch(err, content) { | |
if (err) { | |
console.log(err); | |
return; | |
} | |
console.log(content); | |
} | |
}, { | |
key: 'render', | |
value: function render() { | |
return _react2['default'].createElement( | |
_reactNative.View, | |
{ style: styles.container }, | |
_react2['default'].createElement( | |
_reactNative.Text, | |
null, | |
'Sandbox' | |
) | |
); | |
} | |
}]); | |
return sandbox; | |
})(_react.Component); | |
exports['default'] = sandbox; | |
_reactNative.AppRegistry.registerComponent('sandbox', function () { | |
return sandbox; | |
}); | |
module.exports = exports['default']; | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">import React, { Component } from 'react'; | |
import { AppRegistry, StyleSheet, Text, View } from 'react-native'; | |
import algoliasearch from 'algoliasearch/reactnative'; | |
const queries = [ | |
{ | |
indexName: 'prod_shows', | |
query: 'Accra', | |
params: { | |
hitsPerPage: '10', | |
page: '0', | |
attributesToRetrieve: '*', | |
facets: '["country"]', | |
facetFilters: '[["country:GH"]]' | |
} | |
}, | |
{ | |
indexName: 'prod_stations', | |
query: 'Accra', | |
params: { | |
hitsPerPage: '10', | |
page: '0', | |
attributesToRetrieve: '*', | |
facets: '["country"]', | |
facetFilters: '[["country:GH"]]' | |
} | |
} | |
]; | |
export default class sandbox extends Component { | |
constructor(props) { | |
super(props); | |
this.client = algoliasearch(APP_ID, API_KEY); | |
} | |
componentDidMount() { | |
this.client.search(queries, this.handleSearch); | |
} | |
handleSearch(err, content) { | |
if (err) { | |
console.log(err); | |
return; | |
} | |
console.log(content); | |
} | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Text>Sandbox</Text> | |
</View> | |
); | |
} | |
} | |
AppRegistry.registerComponent('sandbox', () => sandbox);</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
Object.defineProperty(exports, '__esModule', { | |
value: true | |
}); | |
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | |
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | |
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | |
var _react = require('react'); | |
var _react2 = _interopRequireDefault(_react); | |
var _reactNative = require('react-native'); | |
var _algoliasearchReactnative = require('algoliasearch/reactnative'); | |
var _algoliasearchReactnative2 = _interopRequireDefault(_algoliasearchReactnative); | |
var queries = [{ | |
indexName: 'prod_shows', | |
query: 'Accra', | |
params: { | |
hitsPerPage: '10', | |
page: '0', | |
attributesToRetrieve: '*', | |
facets: '["country"]', | |
facetFilters: '[["country:GH"]]' | |
} | |
}, { | |
indexName: 'prod_stations', | |
query: 'Accra', | |
params: { | |
hitsPerPage: '10', | |
page: '0', | |
attributesToRetrieve: '*', | |
facets: '["country"]', | |
facetFilters: '[["country:GH"]]' | |
} | |
}]; | |
var sandbox = (function (_Component) { | |
_inherits(sandbox, _Component); | |
function sandbox(props) { | |
_classCallCheck(this, sandbox); | |
_get(Object.getPrototypeOf(sandbox.prototype), 'constructor', this).call(this, props); | |
this.client = (0, _algoliasearchReactnative2['default'])(APP_ID, API_KEY); | |
} | |
_createClass(sandbox, [{ | |
key: 'componentDidMount', | |
value: function componentDidMount() { | |
this.client.search(queries, this.handleSearch); | |
} | |
}, { | |
key: 'handleSearch', | |
value: function handleSearch(err, content) { | |
if (err) { | |
console.log(err); | |
return; | |
} | |
console.log(content); | |
} | |
}, { | |
key: 'render', | |
value: function render() { | |
return _react2['default'].createElement( | |
_reactNative.View, | |
{ style: styles.container }, | |
_react2['default'].createElement( | |
_reactNative.Text, | |
null, | |
'Sandbox' | |
) | |
); | |
} | |
}]); | |
return sandbox; | |
})(_react.Component); | |
exports['default'] = sandbox; | |
_reactNative.AppRegistry.registerComponent('sandbox', function () { | |
return sandbox; | |
}); | |
module.exports = exports['default']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment