Sha256: 930d1939201be7455da6be0f70bef244ec834028e227af67e2df786c845e22a7
Contents?: true
Size: 1.42 KB
Versions: 5
Compression:
Stored size: 1.42 KB
Contents
<!DOCTYPE html> <html> <!-- Copyright 2010 The Closure Library Authors. All Rights Reserved. Use of this source code is governed by the Apache License, Version 2.0. See the COPYING file for details. --> <head> <title>History Demo JavaScript Page</title> </head> <body> <script src="../base.js"></script> <script> goog.require('goog.History'); goog.require('goog.debug.DivConsole'); goog.require('goog.debug.Logger'); goog.require('goog.dom'); goog.require('goog.events'); goog.require('goog.history.EventType'); </script> <script> var logger = goog.debug.Logger.getLogger('demo'); var logconsole = new goog.debug.DivConsole(top.document.getElementById('log')); logconsole.setCapturing(true); var events = goog.object.getValues(goog.history.EventType); logger.info('Listening for: ' + events.join(', ') + '.'); var googHist = new goog.History( false, 'history_blank.html', top.document.getElementById('hist_state')); goog.events.listen(googHist, events, function(e) { logger.info(goog.string.subs('dispatched: %s (token="%s", isNavigation=%s)', e.type, e.token, e.isNavigation)); }); goog.events.listen(googHist, goog.History.EventType.NAVIGATE, navCallback); googHist.setEnabled(true); function navCallback(e) { var output = top.document.getElementById('token_output'); if (output) { var token = (e.token == null) ? 'null' : '\u201C' + e.token + '\u201D'; goog.dom.setTextContent(output, token); } } </script> </body> </html>
Version data entries
5 entries across 5 versions & 1 rubygems