Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "qhistory", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Wrap history with query support", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -1,6 +0,6 @@ | ||
# Q History | ||
# qhistory | ||
Add query object support to [`history`](https://github.com/ReactTraining/history) library location objects. | ||
You will need to supply `stringify` and `parse` methods. | ||
You will need to supply `stringify` and `parse` methods. | ||
@@ -75,1 +75,34 @@ #### `stringify` | ||
``` | ||
#### If you're using React Router 4's BrowserRouter you can incorporate qhistory like this: | ||
```js | ||
class QueryRouter extends React.Component { | ||
static propTypes = { | ||
basename: PropTypes.string, | ||
forceRefresh: PropTypes.bool, | ||
getUserConfirmation: PropTypes.func, | ||
keyLength: PropTypes.number, | ||
children: PropTypes.node, | ||
stringify: PropTypes.func, | ||
parse: PropTypes.func, | ||
} | ||
history = qhistory( | ||
createBrowserHistory(this.props), | ||
this.props.stringify, | ||
this.props.parse | ||
) | ||
render() { | ||
return <Router history={this.history} children={this.props.children} /> | ||
} | ||
} | ||
// usage | ||
render(( | ||
<QueryRouter stringify={stringify} parse={parse}> | ||
<App /> | ||
</QueryRouter> | ||
), document.getElementbyId('root')) | ||
``` |
@@ -14,10 +14,10 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
@@ -29,23 +29,23 @@ /******/ var module = installedModules[moduleId] = { | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // identity function for calling harmony imports with the correct context | ||
/******/ __webpack_require__.i = function(value) { return value; }; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
@@ -61,3 +61,3 @@ /******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
@@ -71,9 +71,9 @@ /******/ __webpack_require__.n = function(module) { | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
@@ -89,8 +89,6 @@ /******/ return __webpack_require__(__webpack_require__.s = 1); | ||
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* All rights reserved. | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
@@ -97,0 +95,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.qhistory=n():e.qhistory=n()}(this,function(){return function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var t={};return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=1)}([function(e,n,t){"use strict";var r=function(e,n,t,r,o,i,u,f){if(!e){var c;if(void 0===n)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=[t,r,o,i,u,f],s=0;c=new Error(n.replace(/%s/g,function(){return a[s++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}};e.exports=r},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}n.__esModule=!0;var o=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=t(0),f=r(u),c=function(e,n,t){(0,f.default)("function"==typeof n,"A stringify function is required in order to transform query objects into search strings."),(0,f.default)("function"==typeof t,"A parse function is required in order to transform search strings into query objects.");var r=function(e){"object"===("undefined"==typeof e?"undefined":i(e))&&(e.search=e.query?n(e.query):e.search||"")},u=function(e){var n=e.search;n?e.query=t("?"===n.charAt(0)?n.substring(1):n):e.query={}},c=function(e){var n=["location","length","entries","index","action"];n.forEach(function(n){e.hasOwnProperty(n)&&(a[n]=e[n])})};e.listen(function(n){u(n),c(e)}),u(e.location);var a=o({},e,{push:function(n,t){r(n),e.push(n,t)},replace:function(n,t){r(n),e.replace(n,t)},createHref:function(n){return r(n),e.createHref(n)}});return a};n.default=c}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.qhistory=t():e.qhistory=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,n){"use strict";var r=function(e,t,n,r,o,i,u,f){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,o,i,u,f],a=0;c=new Error(t.replace(/%s/g,function(){return s[a++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}};e.exports=r},function(e,t,n){"use strict";t.__esModule=!0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=n(0),u=function(e){return e&&e.__esModule?e:{default:e}}(i),f=function(e,t,n){(0,u.default)("function"==typeof t,"A stringify function is required in order to transform query objects into search strings."),(0,u.default)("function"==typeof n,"A parse function is required in order to transform search strings into query objects.");var i=function(e){"object"===(void 0===e?"undefined":o(e))&&(e.search=e.query?t(e.query):e.search||"")},f=function(e){var t=e.search;e.query=t?n("?"===t.charAt(0)?t.substring(1):t):{}},c=function(e){["location","length","entries","index","action"].forEach(function(t){e.hasOwnProperty(t)&&(s[t]=e[t])})};e.listen(function(t){f(t),c(e)}),f(e.location);var s=r({},e,{push:function(t,n){i(t),e.push(t,n)},replace:function(t,n){i(t),e.replace(t,n)},createHref:function(t){return i(t),e.createHref(t)}});return s};t.default=f}])}); |
Sorry, the diff of this file is not supported yet
20517
303
108