コード例 #1
0
ファイル: history.ts プロジェクト: Baltox/searchkit
export const createHistory = function(){
  return useQueries(createHistoryFn)({
    stringifyQuery(ob){
      return qs.stringify(ob, {encode:true})
    },
    parseQueryString(str){
      return qs.parse(str)
    }
  })
}
コード例 #2
0
        getUserConfirmation(message, callback) {
            callback(window.confirm(message)) // The default behavior
        }
    })
}

{
    let history = useBeforeUnload(createHistory)()

    history.listenBeforeUnload(function() {
        return 'Are you sure you want to leave this page?'
    })
}

{
    let history = useQueries(createHistory)()

    history.listen(function(location) {
        console.log(location.query)
    })
}

{
    let history = useQueries(createHistory)({
        parseQueryString: function(queryString) {
            // TODO: return a parsed version of queryString
            return {};
        },
        stringifyQuery: function(query) {
            // TODO: return a query string created from query
            return "";
コード例 #3
0
import { createHistory, useQueries } from 'history'

const history = useQueries(createHistory)();

export default history;
コード例 #4
0
        getUserConfirmation(message, callback) {
            callback(window.confirm(message)) // The default behavior
        }
    })
}

{
    let history = useBeforeUnload(createBrowserHistory)()

    history.listenBeforeUnload(function() {
        return 'Are you sure you want to leave this page?'
    })
}

{
    let history = useQueries(createBrowserHistory)()

    history.listen(function(location) {
        console.log(location.query)
    })
}

{
    let history = useQueries(createBrowserHistory)({
        parseQueryString: function(queryString) {
            // TODO: return a parsed version of queryString
            return {};
        },
        stringifyQuery: function(query) {
            // TODO: return a query string created from query
            return "";