| <!DOCTYPE html> |
| <!-- |
| Copyright 2015 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| |
| <link rel="import" href="/base/utils.html"> |
| |
| <script> |
| 'use strict'; |
| |
| tv.exportTo('tv.e.tquery', function() { |
| function Context() { |
| this.event = undefined; |
| this.ancestors = []; |
| } |
| |
| Context.prototype = { |
| push: function(event) { |
| var ctx = new Context(); |
| ctx.ancestors = this.ancestors.slice(); |
| ctx.ancestors.push(event); |
| return ctx; |
| }, |
| |
| pop: function(event) { |
| var ctx = new Context(); |
| ctx.event = this.ancestors[this.ancestors.length - 1]; |
| ctx.ancestors = this.ancestors.slice(0, this.ancestors.length - 1); |
| return ctx; |
| } |
| }; |
| |
| return { |
| Context: Context |
| }; |
| }); |
| </script> |