File: pixeldensitymonitor.html

package info (click to toggle)
aseba-plugin-blockly 20180211%2Bgit-2
  • links: PTS
  • area: non-free
  • in suites: buster
  • size: 64,472 kB
  • sloc: xml: 7,976; python: 2,314; sh: 261; lisp: 24; makefile: 10
file content (51 lines) | stat: -rw-r--r-- 1,613 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!doctype html>
<html>
<!--
Copyright 2013 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>goog.labs.style.PixelDensityMonitor</title>
  <script src="../base.js"></script>
  <script>
    goog.require('goog.debug.DivConsole');
    goog.require('goog.events');
    goog.require('goog.labs.style.PixelDensityMonitor');
    goog.require('goog.labs.style.PixelDensityMonitor.Density');
    goog.require('goog.log');
  </script>
  <link rel="stylesheet" href="css/demo.css">
</head>
<body>
  <h1>goog.labs.style.PixelDensityMonitor</h1>
  <div>
    Move between high dpi and normal screens to see density change events.
  </div>
  <fieldset class="goog-debug-panel">
    <legend>Event log</legend>
    <div class="log" id="log"></div>
  </fieldset>
  <script>
    var logger = goog.log.getLogger('PixelDensityMonitor');

    new goog.debug.DivConsole(goog.dom.getElement('log')).setCapturing(true);

    var monitor = new goog.labs.style.PixelDensityMonitor();
    monitor.start();

    var densityMap = goog.object.create(
        goog.labs.style.PixelDensityMonitor.Density.NORMAL, 'NORMAL',
        goog.labs.style.PixelDensityMonitor.Density.HIGH, 'HIGH');

    goog.events.listen(monitor,
        goog.labs.style.PixelDensityMonitor.EventType.CHANGE,
        function() {
          goog.log.info(logger, 'Density change: ' + densityMap[monitor.getDensity()]);
        });

    goog.log.info(logger, 'Starting density: ' + densityMap[monitor.getDensity()]);
  </script>
</body>
</html>