|
| 1 | +/** |
| 2 | + * @fileoverview Closure compiler externs for the Polymer library. |
| 3 | + * |
| 4 | + * @externs |
| 5 | + * @license |
| 6 | + * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
| 7 | + * This code may only be used under the BSD style license found at |
| 8 | + * http://polymer.github.io/LICENSE.txt. The complete set of authors may be |
| 9 | + * found at http://polymer.github.io/AUTHORS.txt. The complete set of |
| 10 | + * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt. Code |
| 11 | + * distributed by Google as part of the polymer project is also subject to an |
| 12 | + * additional IP rights grant found at http://polymer.github.io/PATENTS.txt. |
| 13 | + */ |
| 14 | + |
| 15 | +/** |
| 16 | + * @param {string} name The name of the declared Polymer element. |
| 17 | + * @param {PolymerElement} prototype The prototype of the element. |
| 18 | + */ |
| 19 | +var Polymer = function(name, prototype) {}; |
| 20 | + |
| 21 | + |
| 22 | +/** @constructor @extends {HTMLElement} */ |
| 23 | +var PolymerElement = function() { |
| 24 | + /** @type {Object.<string, !HTMLElement>} */ |
| 25 | + this.$; |
| 26 | +}; |
| 27 | + |
| 28 | +// Canonical docs for these lifecycle callbacks are here: |
| 29 | +// http://www.polymer-project.org/docs/polymer/polymer.html#lifecyclemethods |
| 30 | + |
| 31 | +/** On create callback. */ |
| 32 | +PolymerElement.prototype.created = function() {}; |
| 33 | +/** On ready callback. */ |
| 34 | +PolymerElement.prototype.ready = function() {}; |
| 35 | +/** On attached to the DOM callback. */ |
| 36 | +PolymerElement.prototype.attached = function() {}; |
| 37 | +/** On DOM ready callback. */ |
| 38 | +PolymerElement.prototype.domReady = function() {}; |
| 39 | +/** On detached from the DOM callback. */ |
| 40 | +PolymerElement.prototype.detached = function() {}; |
| 41 | + |
| 42 | +/** |
| 43 | + * Callback fired when an attribute on the element has been added, changed, or |
| 44 | + * removed. |
| 45 | + * |
| 46 | + * @param {string} name The name of the attribute that changed. |
| 47 | + * @param {*} oldValue The previous value of the attribute, or null if it was |
| 48 | + * added. |
| 49 | + * @param {*} newValue The new value of the attribute, or null if it was |
| 50 | + * removed. |
| 51 | + * @param {string} namespace The namespace of the attribute. |
| 52 | + */ |
| 53 | +PolymerElement.prototype.attributeChanged = function( |
| 54 | + name, oldValue, newValue, namespace) {}; |
| 55 | + |
| 56 | +/** |
| 57 | + * Fire a callback when the light DOM children of an element changes. |
| 58 | + * `callback` is called at most once, and should re-register with onMutation |
| 59 | + * if it cares about further changes to the light DOM. |
| 60 | + * |
| 61 | + * @param {!Node} domNode The node to observe for changes. Often |
| 62 | + * the polymerElement itself. |
| 63 | + * @param {function(!MutationObserver, !Array.<!MutationRecord>)} callback |
| 64 | + * The function to call when changes happen. |
| 65 | + */ |
| 66 | +PolymerElement.prototype.onMutation = function(domNode, callback) {}; |
| 67 | + |
| 68 | + |
| 69 | +/** |
| 70 | + * Call the callback after a given timeout. |
| 71 | + * |
| 72 | + * @param {(Function|string)} callback The function to call after the delay. |
| 73 | + * Called with `this` bound to the polymerElement. |
| 74 | + * @param {Array=} opt_args Arguments to pass to callback. |
| 75 | + * @param {number=} opt_timeoutMillis Minimum delay in milliseconds before |
| 76 | + * calling the callback. |
| 77 | + * @return {number} A handle for `#cancelAsync()` |
| 78 | + */ |
| 79 | +PolymerElement.prototype.async = function( |
| 80 | + callback, opt_args, opt_timeoutMillis) {}; |
| 81 | + |
| 82 | +/** |
| 83 | + * Cancels the async operation with the given handle from executing if |
| 84 | + * it hasn't yet run. See `#async()`. |
| 85 | + * |
| 86 | + * @param {number} handle The handle for the async operation to cancel. |
| 87 | + */ |
| 88 | +PolymerElement.prototype.cancelAsync = function(handle) {}; |
| 89 | + |
| 90 | + |
| 91 | +/** |
| 92 | + * Call the callback after a timeout. Calling job again with the same name |
| 93 | + * resets the timer but will not result in additional calls to callback. |
| 94 | + * |
| 95 | + * @param {string} name |
| 96 | + * @param {Function} callback |
| 97 | + * @param {number} timeoutMillis The minimum delay in milliseconds before |
| 98 | + * calling the callback. |
| 99 | + */ |
| 100 | +PolymerElement.prototype.job = function(name, callback, timeoutMillis) {}; |
| 101 | + |
| 102 | + |
| 103 | +/** |
| 104 | + * When called inside an overriden function of a super class, calls the super |
| 105 | + * class's implementation of that function with the given arguments array. |
| 106 | + * |
| 107 | + * @param {Array<*>=} args The arguments to pass to the super class function. |
| 108 | + */ |
| 109 | +PolymerElement.prototype.super = function(args) {}; |
| 110 | + |
| 111 | + |
| 112 | +/** |
| 113 | + * Fire an event. |
| 114 | + * |
| 115 | + * @param {string} type An event name. |
| 116 | + * @param {*=} detail |
| 117 | + * @param {Node=} onNode Target node. |
| 118 | + * @param {boolean=} bubbles Set false to prevent bubbling, defaults to true. |
| 119 | + * @param {boolean=} cancelable Set false to prevent cancellation, defaults to |
| 120 | + * true. |
| 121 | + * @return {Object} event |
| 122 | + */ |
| 123 | +PolymerElement.prototype.fire = |
| 124 | + function(type, detail, onNode, bubbles, cancelable) {}; |
| 125 | + |
| 126 | + |
| 127 | +/** @constructor @extends {HTMLInputElement} */ |
| 128 | +var InputElement = function() { |
| 129 | +}; |
| 130 | + |
0 commit comments