| 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 |
/** |
| 16 |
* @fileoverview The event object dispatched when the history changes. |
| 17 |
* |
| 18 |
*/ |
| 19 |
|
| 20 |
|
| 21 |
goog.provide('goog.history.Event'); |
| 22 |
|
| 23 |
goog.require('goog.events.Event'); |
| 24 |
goog.require('goog.history.EventType'); |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
/** |
| 29 |
* Event object dispatched after the history state has changed. |
| 30 |
* @param {string} token The string identifying the new history state. |
| 31 |
* @param {boolean} isNavigation True if the event was triggered by a browser |
| 32 |
* action, such as forward or back, clicking on a link, editing the URL, or |
| 33 |
* calling {@code window.history.(go|back|forward)}. |
| 34 |
* False if the token has been changed by a {@code setToken} or |
| 35 |
* {@code replaceToken} call. |
| 36 |
* @constructor |
| 37 |
* @extends {goog.events.Event} |
| 38 |
* @final |
| 39 |
*/ |
| 40 |
goog.history.Event = function(token, isNavigation) { |
| 41 |
goog.events.Event.call(this, goog.history.EventType.NAVIGATE); |
| 42 |
|
| 43 |
/** |
| 44 |
* The current history state. |
| 45 |
* @type {string} |
| 46 |
*/ |
| 47 |
this.token = token; |
| 48 |
|
| 49 |
/** |
| 50 |
* Whether the event was triggered by browser navigation. |
| 51 |
* @type {boolean} |
| 52 |
*/ |
| 53 |
this.isNavigation = isNavigation; |
| 54 |
}; |
| 55 |
goog.inherits(goog.history.Event, goog.events.Event); |