From ccc6bae28d9c3964053fb44da36514d14e7b99ae Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Wed, 23 Sep 2015 22:38:58 -0600 Subject: [PATCH] add option to control how history is updated * Use update option to only process inbound request from URL (no updates on navigation) * Use history option to control whether history is maintained --- README.md | 26 ++++++++++++++++ dist/bespoke-hash.js | 28 +++++++++++++----- dist/bespoke-hash.min.js | 4 +-- lib/bespoke-hash.js | 26 ++++++++++++---- test/spec/bespoke-hashSpec.js | 56 +++++++++++++++++++++++++++++++++-- 5 files changed, 123 insertions(+), 17 deletions(-) mode change 100755 => 100644 dist/bespoke-hash.js mode change 100755 => 100644 dist/bespoke-hash.min.js diff --git a/README.md b/README.md index 31d4fc9..38daaf6 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,32 @@ If you'd like to use named hash routes instead, add `data-bespoke-hash` attribut ``` +### Disabling updates + +You can prevent the URL from being updated after the initial page load by setting the `update` option to `false`. This switch allows you to respond to incoming changes from the URL, but not continue updating the URL when the slide changes. + +``` +bespoke.from('article', [ + bespoke.plugins.hash({ update: false }) +]); +``` + +Default value: `true` + +### History control + +You can control whether this browser history is updated using the `history` option. A value of `false` overwrites the last history entry each time the slide is changed (assuming the `update` option is not `false`). + +``` +bespoke.from('article', [ + bespoke.plugins.hash({ history: false }) +]); +``` + +If updates are disabled and the value of the `history` option is false, the hash will be removed from the URL after the deck is loaded. + +Default value: `true` + ## Package managers ### npm diff --git a/dist/bespoke-hash.js b/dist/bespoke-hash.js old mode 100755 new mode 100644 index 3c95593..f56c3f5 --- a/dist/bespoke-hash.js +++ b/dist/bespoke-hash.js @@ -1,16 +1,18 @@ /*! * bespoke-hash v1.0.2 * - * Copyright 2014, Mark Dalgleish + * Copyright 2015, Mark Dalgleish * This content is released under the MIT license * http://mit-license.org/markdalgleish */ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self);var o=n;o=o.bespoke||(o.bespoke={}),o=o.plugins||(o.plugins={}),o.hash=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o-1&&n-1&&e