event.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2010 The Closure Library Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS-IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /**
  15. * @fileoverview The event object dispatched when the history changes.
  16. *
  17. */
  18. goog.provide('goog.history.Event');
  19. goog.require('goog.events.Event');
  20. goog.require('goog.history.EventType');
  21. /**
  22. * Event object dispatched after the history state has changed.
  23. * @param {string} token The string identifying the new history state.
  24. * @param {boolean} isNavigation True if the event was triggered by a browser
  25. * action, such as forward or back, clicking on a link, editing the URL, or
  26. * calling {@code window.history.(go|back|forward)}.
  27. * False if the token has been changed by a {@code setToken} or
  28. * {@code replaceToken} call.
  29. * @constructor
  30. * @extends {goog.events.Event}
  31. * @final
  32. */
  33. goog.history.Event = function(token, isNavigation) {
  34. goog.events.Event.call(this, goog.history.EventType.NAVIGATE);
  35. /**
  36. * The current history state.
  37. * @type {string}
  38. */
  39. this.token = token;
  40. /**
  41. * Whether the event was triggered by browser navigation.
  42. * @type {boolean}
  43. */
  44. this.isNavigation = isNavigation;
  45. };
  46. goog.inherits(goog.history.Event, goog.events.Event);