Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A Google Closure Library DefinitelyTyped typings
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_eventsource.js
//!! Processing provides [goog.labs.userAgent.engine] from input closure-library/closure/goog/labs/useragent/engine.js
//!! Processing provides [goog.html.TrustedResourceUrl] from input closure-library/closure/goog/html/trustedresourceurl.js
//!! Processing provides [goog.events.EventId] from input closure-library/closure/goog/events/eventid.js
//!! Processing provides [goog.html.SafeUrl] from input closure-library/closure/goog/html/safeurl.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/intl.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_pointerlock.js
//!! Processing provides [goog.dom.vendor] from input closure-library/closure/goog/dom/vendor.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_vibration.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/webkit_notifications.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_geolocation.js
//!! Processing provides [goog.asserts, goog.asserts.AssertionError] from input closure-library/closure/goog/asserts/asserts.js
//!! Processing provides [goog.debug.errorcontext] from input closure-library/closure/goog/debug/errorcontext.js
//!! Processing provides [goog.dom.asserts] from input closure-library/closure/goog/dom/asserts.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_gamepad.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/deprecated.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_requestidlecallback.js
//!! Processing provides [goog.Disposable, goog.dispose, goog.disposeAll] from input closure-library/closure/goog/disposable/disposable.js
//!! Processing provides [goog.net.EventType] from input closure-library/closure/goog/net/eventtype.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_rtc.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/gecko_event.js
//!! Processing provides [goog.dom.BrowserFeature] from input closure-library/closure/goog/dom/browserfeature.js
//!! Processing provides [goog.debug.LogManager, goog.debug.Loggable, goog.debug.Logger, goog.debug.Logger.Level] from input closure-library/closure/goog/debug/logger.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_selectors.js
//!! Processing provides [goog.structs.Map] from input closure-library/closure/goog/structs/map.js
//!! Processing provides [] from input tools/closure-compiler/externs/es3.js
//!! Processing provides [goog.labs.userAgent.browser] from input closure-library/closure/goog/labs/useragent/browser.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/iphone.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_elementtraversal.js
//!! Processing provides [goog.events.Listenable, goog.events.ListenableKey] from input closure-library/closure/goog/events/listenable.js
//!! Processing provides [goog.html.SafeScript] from input closure-library/closure/goog/html/safescript.js
//!! Processing provides [goog.debug.LogRecord] from input closure-library/closure/goog/debug/logrecord.js
//!! Processing provides [goog.net.DefaultXmlHttpFactory, goog.net.XmlHttp, goog.net.XmlHttp.OptionType, goog.net.XmlHttp.ReadyState, goog.net.XmlHttpDefines] from input closure-library/closure/goog/net/xmlhttp.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/gecko_dom.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_dom3.js
//!! Processing provides [goog.events.EventTarget] from input closure-library/closure/goog/events/eventtarget.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/flash.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/google.js
//!! Processing provides [goog.dom.HtmlElement] from input closure-library/closure/goog/dom/htmlelement.js
//!! Processing provides [goog.async.run] from input closure-library/closure/goog/async/run.js
//!! Processing provides [goog.dom.TagName] from input closure-library/closure/goog/dom/tagname.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/webkit_event.js
//!! Processing provides [goog.dom.NodeType] from input closure-library/closure/goog/dom/nodetype.js
//!! Processing provides [goog.dom, goog.dom.Appendable, goog.dom.DomHelper] from input closure-library/closure/goog/dom/dom.js
//!! Processing provides [goog.uri.utils, goog.uri.utils.ComponentIndex, goog.uri.utils.QueryArray, goog.uri.utils.QueryValue, goog.uri.utils.StandardQueryParam] from input closure-library/closure/goog/uri/utils.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/v8.js
//!! Processing provides [goog.events.BrowserEvent, goog.events.BrowserEvent.MouseButton, goog.events.BrowserEvent.PointerType] from input closure-library/closure/goog/events/browserevent.js
//!! Processing provides [goog.object] from input closure-library/closure/goog/object/object.js
//!! Processing provides [goog.reflect] from input closure-library/closure/goog/reflect/reflect.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_serviceworker.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_css3d.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/streamsapi.js
//!! Processing provides [goog.events.ListenerMap] from input closure-library/closure/goog/events/listenermap.js
//!! Processing provides [goog.labs.userAgent.util] from input closure-library/closure/goog/labs/useragent/util.js
//!! Processing provides [] from input [synthetic:base]
//!! Processing provides [goog.debug] from input closure-library/closure/goog/debug/debug.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_midi.js
//!! Processing provides [goog.labs.dom.PageVisibilityEvent, goog.labs.dom.PageVisibilityMonitor, goog.labs.dom.PageVisibilityState] from input closure-library/closure/goog/labs/dom/pagevisibilitymonitor.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/intersection_observer.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_css.js
//!! Processing provides [goog.iter, goog.iter.Iterable, goog.iter.Iterator, goog.iter.StopIteration] from input closure-library/closure/goog/iter/iter.js
//!! Processing provides [goog.net.CorsXmlHttpFactory, goog.net.IeCorsXhrAdapter] from input closure-library/closure/goog/net/corsxmlhttpfactory.js
//!! Processing provides [] from input tools/closure-compiler/externs/es5.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_indexeddb.js
//!! Processing provides [goog.Promise] from input closure-library/closure/goog/promise/promise.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_range.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_dom1.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/url.js
//!! Processing provides [goog.debug.Error] from input closure-library/closure/goog/debug/error.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_pointer_events.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/mediakeys.js
//!! Processing provides [goog.userAgent] from input closure-library/closure/goog/useragent/useragent.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_navigation_timing.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_webcrypto.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/page_visibility.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_audio.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/html5.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_touch_event.js
//!! Processing provides [goog.debug.EntryPointMonitor, goog.debug.entryPointRegistry] from input closure-library/closure/goog/debug/entrypointregistry.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_xml.js
//!! Processing provides [goog.json.hybrid] from input closure-library/closure/goog/json/hybrid.js
//!! Processing provides [goog.promise.Resolver] from input closure-library/closure/goog/promise/resolver.js
//!! Processing provides [goog.disposable.IDisposable] from input closure-library/closure/goog/disposable/idisposable.js
//!! Processing provides [goog.html.SafeStyleSheet] from input closure-library/closure/goog/html/safestylesheet.js
//!! Processing provides [goog.json, goog.json.Replacer, goog.json.Reviver, goog.json.Serializer] from input closure-library/closure/goog/json/json.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_dom4.js
//!! Processing provides [goog.math.Size] from input closure-library/closure/goog/math/size.js
//!! Processing provides [goog.math.Coordinate] from input closure-library/closure/goog/math/coordinate.js
//!! Processing provides [goog.array] from input closure-library/closure/goog/array/array.js
//!! Processing provides [goog.net.XhrLike] from input closure-library/closure/goog/net/xhrlike.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/ie_css.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_event.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/webgl.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/mediasource.js
//!! Processing provides [goog.events.Listener] from input closure-library/closure/goog/events/listener.js
//!! Processing provides [goog.html.SafeHtml] from input closure-library/closure/goog/html/safehtml.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/ie_vml.js
//!! Processing provides [goog.net.WrapperXmlHttpFactory] from input closure-library/closure/goog/net/wrapperxmlhttpfactory.js
//!! Processing provides [goog.Thenable] from input closure-library/closure/goog/promise/thenable.js
//!! Processing provides [goog.Timer] from input closure-library/closure/goog/timer/timer.js
//!! Processing provides [goog.events, goog.events.CaptureSimulationMode, goog.events.Key, goog.events.ListenableType] from input closure-library/closure/goog/events/events.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/window.js
//!! Processing provides [goog.html.uncheckedconversions] from input closure-library/closure/goog/html/uncheckedconversions.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/ie_event.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_netinfo.js
//!! Processing provides [goog.math] from input closure-library/closure/goog/math/math.js
//!! Processing provides [goog.async.WorkItem, goog.async.WorkQueue] from input closure-library/closure/goog/async/workqueue.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/webstorage.js
//!! Processing provides [goog.net.HttpStatus] from input closure-library/closure/goog/net/httpstatus.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_screen_orientation.js
//!! Processing provides [goog] from input closure-library/closure/goog/base.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/whatwg_encoding.js
//!! Processing provides [goog.labs.userAgent.platform] from input closure-library/closure/goog/labs/useragent/platform.js
//!! Processing provides [goog.html.SafeStyle] from input closure-library/closure/goog/html/safestyle.js
//!! Processing provides [goog.events.EventType, goog.events.PointerFallbackEventType] from input closure-library/closure/goog/events/eventtype.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_batterystatus.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/webkit_dom.js
//!! Processing provides [goog.log, goog.log.Level, goog.log.LogRecord, goog.log.Logger] from input closure-library/closure/goog/log/log.js
//!! Processing provides [goog.async.nextTick, goog.async.throwException] from input closure-library/closure/goog/async/nexttick.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_device_sensor_event.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_permissions.js
//!! Processing provides [goog.memoize] from input closure-library/closure/goog/memoize/memoize.js
//!! Processing provides [goog.string, goog.string.Unicode] from input closure-library/closure/goog/string/string.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_dom2.js
//!! Processing provides [goog.functions] from input closure-library/closure/goog/functions/functions.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/gecko_css.js
//!! Processing provides [goog.string.TypedString] from input closure-library/closure/goog/string/typedstring.js
//!! Processing provides [goog.dom.safe, goog.dom.safe.InsertAdjacentHtmlPosition] from input closure-library/closure/goog/dom/safe.js
//!! Processing provides [goog.math.ExponentialBackoff] from input closure-library/closure/goog/math/exponentialbackoff.js
//!! Processing provides [goog.net.Cookies, goog.net.cookies] from input closure-library/closure/goog/net/cookies.js
//!! Processing provides [goog.events.Event, goog.events.EventLike] from input closure-library/closure/goog/events/event.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/gecko_xml.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/webkit_usercontent.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/fileapi.js
//!! Processing provides [goog.net.XhrIo, goog.net.XhrIo.ResponseType] from input closure-library/closure/goog/net/xhrio.js
//!! Processing provides [goog.i18n.bidi, goog.i18n.bidi.Dir, goog.i18n.bidi.DirectionalString, goog.i18n.bidi.Format] from input closure-library/closure/goog/i18n/bidi.js
//!! Processing provides [] from input tools/closure-compiler/externs/es6_collections.js
//!! Processing provides [goog.events.BrowserFeature] from input closure-library/closure/goog/events/browserfeature.js
//!! Processing provides [goog.dom.tags] from input closure-library/closure/goog/dom/tags.js
//!! Processing provides [goog.structs] from input closure-library/closure/goog/structs/structs.js
//!! Processing provides [goog.debug.LogBuffer] from input closure-library/closure/goog/debug/logbuffer.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/ie_dom.js
//!! Processing provides [goog.fs.url] from input closure-library/closure/goog/fs/url.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_event3.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/webkit_css.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/fetchapi.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_anim_timing.js
//!! Processing provides [] from input tools/closure-compiler/externs/es6.js
//!! Processing provides [goog.net.XmlHttpFactory] from input closure-library/closure/goog/net/xmlhttpfactory.js
//!! Processing provides [goog.string.Const] from input closure-library/closure/goog/string/const.js
//!! Processing provides [goog.async.FreeList] from input closure-library/closure/goog/async/freelist.js
//!! Processing provides [goog.net.ErrorCode] from input closure-library/closure/goog/net/errorcode.js
declare namespace goog {
var DEBUG : boolean ;
var DEBUG_LOADER : string ;
/**
* True if goog.dependencies_ is available.
*/
var DEPENDENCIES_ENABLED : boolean ;
var DISALLOW_TEST_ONLY_CODE : boolean ;
/**
* A debug loader is responsible for downloading and executing javascript
* files in an unbundled, uncompiled environment.
*/
class DebugLoader extends DebugLoader_Instance {
}
class DebugLoader_Instance {
private noStructuralTyping_: any;
addDependency (relPath : string , provides : string [] , requires : string [] , opt_loadFlags ? : boolean | { [ /* warning: coerced from ? */ key: string ]: string } ) : void ;
/**
* Performs any needed preprocessing of a goog.require call.
*/
earlyProcessLoad (name : string ) : void ;
getTranspiler ( ) : ಠ_ಠ.clutz.goog.Transpiler ;
inHtmlDocument ( ) : boolean ;
isProvided (namespaceOrPath : string ) : boolean ;
/**
* Loads the given symbol along with any dependencies.
*/
load (name : string ) : void ;
loadFileSync (srcUrl : string ) : string | null ;
logToConsole (message : string ) : void ;
normalizePath (path : string ) : string ;
}
var ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING : boolean ;
var ENABLE_DEBUG_LOADER : boolean ;
var LOAD_MODULE_USING_EVAL : boolean ;
var LOCALE : string ;
var NATIVE_ARRAY_PROTOTYPES : boolean ;
var SEAL_MODULE_EXPORTS : boolean ;
var STRICT_MODE_COMPATIBLE : boolean ;
var TRANSPILE : string ;
var TRANSPILER : string ;
var TRUSTED_SITE : boolean ;
class Transpiler extends Transpiler_Instance {
}
class Transpiler_Instance {
private noStructuralTyping_: any;
/**
* Determines whether the given language needs to be transpiled.
*/
needsTranspile (lang : string ) : boolean ;
/**
* Lazily retrieves the transpiler and applies it to the source.
* @param code JS code.
* @param path Path to the code.
*/
transpile (code : string , path : string ) : string ;
}
/**
* When defining a class Foo with an abstract method bar(), you can do:
* Foo.prototype.bar = goog.abstractMethod
*
* Now if a subclass of Foo fails to override bar(), an error will be thrown
* when bar() is invoked.
*/
function abstractMethod ( ...a : any [] ) : any ;
/**
* Adds a dependency from a file to the files it requires.
* @param relPath The path to the js file.
* @param provides An array of strings with the names of the objects this file provides.
* @param requires An array of strings with the names of the objects this file requires.
* @param opt_loadFlags Parameters indicating how the file must be loaded. The boolean 'true' is equivalent to {'module': 'goog'} for backwards-compatibility. Valid properties and values include {'module': 'goog'} and {'lang': 'es6'}.
*/
function addDependency (relPath : string , provides : string [] , requires : string [] , opt_loadFlags ? : boolean | { [ /* warning: coerced from ? */ key: string ]: string } ) : void ;
/**
* Adds a {@code getInstance} static method that always returns the same
* instance object.
* @param ctor The constructor for the class to add the static method to.
*/
function addSingletonGetter (ctor : Function ) : void ;
/**
* Call up to the superclass.
*
* If this is called from a constructor, then this calls the superclass
* constructor with arguments 1-N.
*
* If this is called from a prototype method, then you must pass the name of the
* method as the second argument to this function. If you do not, you will get a
* runtime error. This calls the superclass' method with arguments 2-N.
*
* This function only works if you use goog.inherits to express inheritance
* relationships between your classes.
*
* This function is a compiler primitive. At compile-time, the compiler will do
* macro expansion to remove a lot of the extra overhead that this function
* introduces. The compiler will also enforce a lot of the assumptions that this
* function makes, and treat it as a compiler error if you break them.
* @param me Should always be "this".
* @param opt_methodName The method name if calling a super method.
* @param var_args The rest of the arguments.
*/
function base (me : GlobalObject , opt_methodName ? : any , ...var_args : any [] ) : any ;
/**
* Path for included scripts.
*/
var basePath : string ;
/**
* Partially applies this function to a particular 'this object' and zero or
* more arguments. The result is a new function with some arguments of the first
* function pre-filled and the value of this 'pre-specified'.
*
* Remaining arguments specified at call-time are appended to the pre-specified
* ones.
*
* Also see: {@link #partial}.
*
* Usage:
* <pre>var barMethBound = goog.bind(myFunction, myObj, 'arg1', 'arg2');
* barMethBound('arg3', 'arg4');</pre>
* @param fn A function to partially apply.
* @param selfObj Specifies the object which this should point to when the function is run.
* @param var_args Additional arguments that are partially applied to the function.
*/
function bind < T > (fn : ( ( ...a : any [] ) => any ) | null , selfObj : T , ...var_args : any [] ) : Function ;
/**
* Clones a value. The input may be an Object, Array, or basic type. Objects and
* arrays will be cloned recursively.
*
* WARNINGS:
* <code>goog.cloneObject</code> does not detect reference loops. Objects that
* refer to themselves will cause infinite recursion.
*
* <code>goog.cloneObject</code> is unaware of unique identifiers, and copies
* UIDs created by <code>getUid</code> into cloned results.
* @param obj The value to clone.
*/
function cloneObject (obj : any ) : any ;
/**
* Defines a named value. In uncompiled mode, the value is retrieved from
* CLOSURE_DEFINES or CLOSURE_UNCOMPILED_DEFINES if the object is defined and
* has the property specified, and otherwise used the defined defaultValue.
* When compiled the default can be overridden using the compiler
* options or the value set in the CLOSURE_DEFINES object.
* @param name The distinguished name to provide.
*/
function define (name : string , defaultValue : string | number | boolean ) : void ;
/**
* Creates a restricted form of a Closure "class":
* - from the compiler's perspective, the instance returned from the
* constructor is sealed (no new properties may be added). This enables
* better checks.
* - the compiler will rewrite this definition to a form that is optimal
* for type checking and optimization (initially this will be a more
* traditional form).
* @param superClass The superclass, Object or null.
* @param def An object literal describing the class. It may have the following properties: "constructor": the constructor function "statics": an object literal containing methods to add to the constructor as "static" methods or a function that will receive the constructor function as its only parameter to which static properties can be added. all other properties are added to the prototype.
*/
function defineClass (superClass : Function | null , def : ಠ_ಠ.clutz.goog.defineClass.ClassDescriptor ) : Function ;
/**
* Exports a property unobfuscated into the object's namespace.
* ex. goog.exportProperty(Foo, 'staticFunction', Foo.staticFunction);
* ex. goog.exportProperty(Foo.prototype, 'myMethod', Foo.prototype.myMethod);
* @param object Object whose static property is being exported.
* @param publicName Unobfuscated name to export.
* @param symbol Object the name should point to.
*/
function exportProperty (object : GlobalObject | null , publicName : string , symbol : any ) : void ;
/**
* Exposes an unobfuscated global namespace path for the given object.
* Note that fields of the exported object *will* be obfuscated, unless they are
* exported in turn via this function or goog.exportProperty.
*
* Also handy for making public items that are defined in anonymous closures.
*
* ex. goog.exportSymbol('public.path.Foo', Foo);
*
* ex. goog.exportSymbol('public.path.Foo.staticFunction', Foo.staticFunction);
* public.path.Foo.staticFunction();
*
* ex. goog.exportSymbol('public.path.Foo.prototype.myMethod',
* Foo.prototype.myMethod);
* new public.path.Foo().myMethod();
* @param publicPath Unobfuscated name to export.
* @param object Object the name should point to.
* @param opt_objectToExportTo The object to add the path to; default is goog.global.
*/
function exportSymbol (publicPath : string , object : any , opt_objectToExportTo ? : GlobalObject | null ) : void ;
/**
* Forward declares a symbol. This is an indication to the compiler that the
* symbol may be used in the source yet is not required and may not be provided
* in compilation.
*
* The most common usage of forward declaration is code that takes a type as a
* function parameter but does not need to require it. By forward declaring
* instead of requiring, no hard dependency is made, and (if not required
* elsewhere) the namespace may never be required and thus, not be pulled
* into the JavaScript binary. If it is required elsewhere, it will be type
* checked as normal.
*
* Before using goog.forwardDeclare, please read the documentation at
* https://github.com/google/closure-compiler/wiki/Bad-Type-Annotation to
* understand the options and tradeoffs when working with forward declarations.
* @param name The namespace to forward declare in the form of "goog.package.part".
*/
function forwardDeclare (name : string ) : void ;
/**
* Handles strings that are intended to be used as CSS class names.
*
* This function works in tandem with @see goog.setCssNameMapping.
*
* Without any mapping set, the arguments are simple joined with a hyphen and
* passed through unaltered.
*
* When there is a mapping, there are two possible styles in which these
* mappings are used. In the BY_PART style, each part (i.e. in between hyphens)
* of the passed in css name is rewritten according to the map. In the BY_WHOLE
* style, the full css name is looked up in the map directly. If a rewrite is
* not specified by the map, the compiler will output a warning.
*
* When the mapping is passed to the compiler, it will replace calls to
* goog.getCssName with the strings from the mapping, e.g.
* var x = goog.getCssName('foo');
* var y = goog.getCssName(this.baseClass, 'active');
* becomes:
* var x = 'foo';
* var y = this.baseClass + '-active';
*
* If one argument is passed it will be processed, if two are passed only the
* modifier will be processed, as it is assumed the first argument was generated
* as a result of calling goog.getCssName.
* @param className The class name.
* @param opt_modifier A modifier to be appended to the class name.
*/
function getCssName (className : string , opt_modifier ? : string ) : string ;
/**
* Adds a hash code field to an object. The hash code is unique for the
* given object.
* @param obj The object to get the hash code for.
*/
function getHashCode (a : GlobalObject | null ) : number ;
/**
* Gets a localized message.
*
* This function is a compiler primitive. If you give the compiler a localized
* message bundle, it will replace the string at compile-time with a localized
* version, and expand goog.getMsg call to a concatenated string.
*
* Messages must be initialized in the form:
* <code>
* var MSG_NAME = goog.getMsg('Hello {$placeholder}', {'placeholder': 'world'});
* </code>
*
* This function produces a string which should be treated as plain text. Use
* {@link goog.html.SafeHtmlFormatter} in conjunction with goog.getMsg to
* produce SafeHtml.
* @param str Translatable string, places holders in the form {$foo}.
* @param opt_values Maps place holder name to value.
*/
function getMsg (str : string , opt_values ? : { [ key: string ]: string } | null ) : string ;
/**
* Gets a localized message. If the message does not have a translation, gives a
* fallback message.
*
* This is useful when introducing a new message that has not yet been
* translated into all languages.
*
* This function is a compiler primitive. Must be used in the form:
* <code>var x = goog.getMsgWithFallback(MSG_A, MSG_B);</code>
* where MSG_A and MSG_B were initialized with goog.getMsg.
* @param a The preferred message.
* @param b The fallback message.
*/
function getMsgWithFallback (a : string , b : string ) : string ;
/**
* Returns an object based on its fully qualified external name. The object
* is not found if null or undefined. If you are using a compilation pass that
* renames property names beware that using this function will not find renamed
* properties.
* @param name The fully qualified name.
* @param opt_obj The object within which to look; default is |goog.global|.
*/
function getObjectByName (name : string , opt_obj ? : GlobalObject | null ) : any ;
/**
* Gets a unique ID for an object. This mutates the object so that further calls
* with the same object as a parameter returns the same value. The unique ID is
* guaranteed to be unique across the current session amongst objects that are
* passed into {@code getUid}. There is no guarantee that the ID is unique or
* consistent across sessions. It is unsafe to generate unique ID for function
* prototypes.
* @param obj The object to get the unique ID for.
*/
function getUid (obj : GlobalObject | null ) : number ;
/**
* Evals JavaScript in the global scope. In IE this uses execScript, other
* browsers use goog.global.eval. If goog.global.eval does not evaluate in the
* global scope (for example, in Safari), appends a script tag instead.
* Throws an exception if neither execScript or eval is defined.
* @param script JavaScript string.
*/
function globalEval (script : string ) : void ;
/**
* Globalizes a whole namespace, such as goog or goog.lang.
* @param obj The namespace to globalize.
* @param opt_global The object to add the properties to.
*/
function globalize (obj : GlobalObject , opt_global ? : GlobalObject | null ) : void ;
var hasBadLetScoping : boolean | null ;
/**
* Whether the given object is already assigned a unique ID.
*
* This does not modify the object.
* @param obj The object to check.
*/
function hasUid (obj : GlobalObject ) : boolean ;
/**
* Inherit the prototype methods from one constructor into another.
*
* Usage:
* <pre>
* function ParentClass(a, b) { }
* ParentClass.prototype.foo = function(a) { };
*
* function ChildClass(a, b, c) {
* ChildClass.base(this, 'constructor', a, b);
* }
* goog.inherits(ChildClass, ParentClass);
*
* var child = new ChildClass('a', 'b', 'see');
* child.foo(); // This works.
* </pre>
* @param childCtor Child class.
* @param parentCtor Parent class.
*/
function inherits (childCtor : Function , parentCtor : Function ) : void ;
/**
* Returns true if the specified value is an array.
* @param val Variable to test.
*/
function isArray (val : any ) : boolean ;
/**
* Returns true if the object looks like an array. To qualify as array like
* the value needs to be either a NodeList or an object with a Number length
* property. As a special case, a function value is not array like, because its
* length property is fixed to correspond to the number of expected arguments.
* @param val Variable to test.
*/
function isArrayLike (val : any ) : boolean ;
/**
* Returns true if the specified value is a boolean.
* @param val Variable to test.
*/
function isBoolean (val : any ) : boolean ;
/**
* Returns true if the object looks like a Date. To qualify as Date-like the
* value needs to be an object and have a getFullYear() function.
* @param val Variable to test.
*/
function isDateLike (val : any ) : boolean ;
/**
* Returns true if the specified value is not undefined.
* @param val Variable to test.
*/
function isDef (val : any ) : boolean ;
/**
* Returns true if the specified value is defined and not null.
* @param val Variable to test.
*/
function isDefAndNotNull (val : any ) : boolean ;
/**
* Returns true if the specified value is a function.
* @param val Variable to test.
*/
function isFunction (val : any ) : boolean ;
/**
* Returns true if the specified value is null.
* @param val Variable to test.
*/
function isNull (val : any ) : boolean ;
/**
* Returns true if the specified value is a number.
* @param val Variable to test.
*/
function isNumber (val : any ) : boolean ;
/**
* Returns true if the specified value is an object. This includes arrays and
* functions.
* @param val Variable to test.
*/
function isObject (val : any ) : boolean ;
/**
* Returns true if the specified value is a string.
* @param val Variable to test.
*/
function isString (val : any ) : boolean ;
function loadModule (moduleDef : ( (a : any ) => any ) | string ) : void ;
/**
* Copies all the members of a source object to a target object. This method
* does not work on all browsers for all objects that contain keys such as
* toString or hasOwnProperty. Use goog.object.extend for this purpose.
* @param target Target.
* @param source Source.
*/
function mixin (target : GlobalObject | null , source : GlobalObject | null ) : void ;
/**
* Defines a module in Closure.
*
* Marks that this file must be loaded as a module and claims the namespace.
*
* A namespace may only be defined once in a codebase. It may be defined using
* goog.provide() or goog.module().
*
* goog.module() has three requirements:
* - goog.module may not be used in the same file as goog.provide.
* - goog.module must be the first statement in the file.
* - only one goog.module is allowed per file.
*
* When a goog.module annotated file is loaded, it is enclosed in
* a strict function closure. This means that:
* - any variables declared in a goog.module file are private to the file
* (not global), though the compiler is expected to inline the module.
* - The code must obey all the rules of "strict" JavaScript.
* - the file will be marked as "use strict"
*
* NOTE: unlike goog.provide, goog.module does not declare any symbols by
* itself. If declared symbols are desired, use
* goog.module.declareLegacyNamespace().
*
*
* See the public goog.module proposal: http://goo.gl/Va1hin
* @param name Namespace provided by this file in the form "goog.package.part", is expected but not required.
*/
function module (name : string ) : void ;
function now ( ) : number ;
/**
* Null function used for default values of callbacks, etc.
*/
function nullFunction ( ) : void ;
/**
* Like goog.bind(), except that a 'this object' is not required. Useful when
* the target function is already bound.
*
* Usage:
* var g = goog.partial(f, arg1, arg2);
* g(arg3, arg4);
* @param fn A function to partially apply.
* @param var_args Additional arguments that are partially applied to fn.
*/
function partial (fn : Function | null , ...var_args : any [] ) : Function ;
/**
* Defines a namespace in Closure.
*
* A namespace may only be defined once in a codebase. It may be defined using
* goog.provide() or goog.module().
*
* The presence of one or more goog.provide() calls in a file indicates
* that the file defines the given objects/namespaces.
* Provided symbols must not be null or undefined.
*
* In addition, goog.provide() creates the object stubs for a namespace
* (for example, goog.provide("goog.foo.bar") will create the object
* goog.foo.bar if it does not already exist).
*
* Build tools also scan for provide/require/module statements
* to discern dependencies, build dependency files (see deps.js), etc.
* @param name Namespace provided by this file in the form "goog.package.part".
*/
function provide (name : string ) : void ;
function registerDebugLoader (loader : ಠ_ಠ.clutz.goog.DebugLoader ) : void ;
/**
* Removes the hash code field from an object.
* @param obj The object to remove the field from.
*/
function removeHashCode (a : GlobalObject | null ) : any ;
/**
* Removes the unique ID from an object. This is useful if the object was
* previously mutated using {@code goog.getUid} in which case the mutation is
* undone.
* @param obj The object to remove the unique ID field from.
*/
function removeUid (obj : GlobalObject | null ) : void ;
function require (name : string ) : ಠ_ಠ.clutz.ClosureSymbolNotGoogProvided;
/**
* Allow for aliasing within scope functions. This function exists for
* uncompiled code - in compiled code the calls will be inlined and the aliases
* applied. In uncompiled code the function is simply run since the aliases as
* written are valid JavaScript.
* @param fn Function to call. This function can contain aliases to namespaces (e.g. "var dom = goog.dom") or classes (e.g. "var Timer = goog.Timer").
*/
function scope (fn : ( ) => any ) : void ;
/**
* Sets the map to check when returning a value from goog.getCssName(). Example:
* <pre>
* goog.setCssNameMapping({
* "goog": "a",
* "disabled": "b",
* });
*
* var x = goog.getCssName('goog');
* // The following evaluates to: "a a-b".
* goog.getCssName('goog') + ' ' + goog.getCssName(x, 'disabled')
* </pre>
* When declared as a map of string literals to string literals, the JSCompiler
* will replace all calls to goog.getCssName() using the supplied map if the
* --process_closure_primitives flag is set.
* @param mapping A map of strings to strings where keys are possible arguments to goog.getCssName() and values are the corresponding values that should be returned.
* @param opt_style The style of css name mapping. There are two valid options: 'BY_PART', and 'BY_WHOLE'.
*/
function setCssNameMapping (mapping : GlobalObject , opt_style ? : string ) : void ;
/**
* Marks that the current file should only be used for testing, and never for
* live code in production.
*
* In the case of unit tests, the message may optionally be an exact namespace
* for the test (e.g. 'goog.stringTest'). The linter will then ignore the extra
* provide (if not explicitly defined in the code).
* @param opt_message Optional message to add to the error that's raised when used in production code.
*/
function setTestOnly (opt_message ? : string ) : void ;
/**
* Sealing classes breaks the older idiom of assigning properties on the
* prototype rather than in the constructor. As such, goog.defineClass
* must not seal subclasses of these old-style classes until they are fixed.
* Until then, this marks a class as "broken", instructing defineClass
* not to seal subclasses.
* @param ctr The legacy constructor to tag as unsealable.
*/
function tagUnsealableClass (ctr : Function ) : void ;
/**
* This is a "fixed" version of the typeof operator. It differs from the typeof
* operator in such a way that null returns 'null' and arrays return 'array'.
* @param value The value to get the type of.
*/
function typeOf (value : any ) : string ;
function useSafari10Workaround ( ) : boolean ;
function workaroundSafari10EvalBug (moduleDef : string ) : string ;
}
declare namespace ಠ_ಠ.clutz.goog {
/**
* Class that provides the basic implementation for disposable objects. If your
* class holds one or more references to COM objects, DOM nodes, or other
* disposable objects, it should extend this class or implement the disposable
* interface (defined in goog.disposable.IDisposable).
*/
class Disposable extends Disposable_Instance {
static INCLUDE_STACK_ON_CREATION : boolean ;
static MONITORING_MODE : number ;
/**
* Clears the registry of undisposed objects but doesn't dispose of them.
*/
static clearUndisposedObjects ( ) : void ;
static getUndisposedObjects ( ) : ಠ_ಠ.clutz.goog.Disposable [] ;
/**
* Returns True if we can verify the object is disposed.
* Calls {@code isDisposed} on the argument if it supports it. If obj
* is not an object with an isDisposed() method, return false.
* @param obj The object to investigate.
*/
static isDisposed (obj : any ) : boolean ;
}
class Disposable_Instance implements ಠ_ಠ.clutz.goog.disposable.IDisposable {
private noStructuralTyping_: any;
/**
* If monitoring the goog.Disposable instances is enabled, stores the creation
* stack trace of the Disposable instance.
*/
creationStack ? : string ;
/**
* Invokes a callback function when this object is disposed. Callbacks are
* invoked in the order in which they were added. If a callback is added to
* an already disposed Disposable, it will be called immediately.
* @param callback The callback function.
* @param opt_scope An optional scope to call the callback in.
*/
addOnDisposeCallback < T > (callback : ( ) => any , opt_scope ? : T ) : void ;
/**
* Disposes of the object. If the object hasn't already been disposed of, calls
* {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should
* override {@link #disposeInternal} in order to delete references to COM
* objects, DOM nodes, and other disposable objects. Reentrant.
*/
dispose ( ) : void ;
/**
* Deletes or nulls out any references to COM objects, DOM nodes, or other
* disposable objects. Classes that extend {@code goog.Disposable} should
* override this method.
* Not reentrant. To avoid calling it twice, it must only be called from the
* subclass' {@code disposeInternal} method. Everywhere else the public
* {@code dispose} method must be used.
* For example:
* <pre>
* mypackage.MyClass = function() {
* mypackage.MyClass.base(this, 'constructor');
* // Constructor logic specific to MyClass.
* ...
* };
* goog.inherits(mypackage.MyClass, goog.Disposable);
*
* mypackage.MyClass.prototype.disposeInternal = function() {
* // Dispose logic specific to MyClass.
* ...
* // Call superclass's disposeInternal at the end of the subclass's, like
* // in C++, to avoid hard-to-catch issues.
* mypackage.MyClass.base(this, 'disposeInternal');
* };
* </pre>
*/
disposeInternal ( ) : void ;
getDisposed ( ) : boolean ;
isDisposed ( ) : boolean ;
/**
* Associates a disposable object with this object so that they will be disposed
* together.
* @param disposable that will be disposed when this object is disposed.
*/
registerDisposable (disposable : ಠ_ಠ.clutz.goog.disposable.IDisposable | null ) : void ;
}
}
declare namespace ಠ_ಠ.clutz.goog.Disposable {
enum MonitoringMode {
INTERACTIVE ,
OFF ,
PERMANENT ,
}
}
declare module 'goog:goog.Disposable' {
import alias = ಠ_ಠ.clutz.goog.Disposable;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog {
/**
* NOTE: This class was created in anticipation of the built-in Promise type
* being standardized and implemented across browsers. Now that Promise is
* available in modern browsers, and is automatically polyfilled by the Closure
* Compiler, by default, most new code should use native {@code Promise}
* instead of {@code goog.Promise}. However, {@code goog.Promise} has the
* concept of cancellation which native Promises do not yet have. So code
* needing cancellation may still want to use {@code goog.Promise}.
*
* Promises provide a result that may be resolved asynchronously. A Promise may
* be resolved by being fulfilled with a fulfillment value, rejected with a
* rejection reason, or blocked by another Promise. A Promise is said to be
* settled if it is either fulfilled or rejected. Once settled, the Promise
* result is immutable.
*
* Promises may represent results of any type, including undefined. Rejection
* reasons are typically Errors, but may also be of any type. Closure Promises
* allow for optional type annotations that enforce that fulfillment values are
* of the appropriate types at compile time.
*
* The result of a Promise is accessible by calling {@code then} and registering
* {@code onFulfilled} and {@code onRejected} callbacks. Once the Promise
* is settled, the relevant callbacks are invoked with the fulfillment value or
* rejection reason as argument. Callbacks are always invoked in the order they
* were registered, even when additional {@code then} calls are made from inside
* another callback. A callback is always run asynchronously sometime after the
* scope containing the registering {@code then} invocation has returned.
*
* If a Promise is resolved with another Promise, the first Promise will block
* until the second is settled, and then assumes the same result as the second
* Promise. This allows Promises to depend on the results of other Promises,
* linking together multiple asynchronous operations.
*
* This implementation is compatible with the Promises/A+ specification and
* passes that specification's conformance test suite. A Closure Promise may be
* resolved with a Promise instance (or sufficiently compatible Promise-like
* object) created by other Promise implementations. From the specification,
* Promise-like objects are known as "Thenables".
*/
class Promise < TYPE , RESOLVER_CONTEXT > extends Promise_Instance < TYPE , RESOLVER_CONTEXT > {
static DEFAULT_MAX_UNUSED : number ;
static LONG_STACK_TRACES : boolean ;
static UNHANDLED_REJECTION_DELAY : number ;
static all < TYPE > (promises : ಠ_ಠ.clutz.goog.uri.utils.QueryArray ) : ಠ_ಠ.clutz.goog.Promise < TYPE [] , any > ;
static allSettled < TYPE > (promises : ಠ_ಠ.clutz.goog.uri.utils.QueryArray ) : ಠ_ಠ.clutz.goog.Promise < { fulfilled : boolean , reason ? : any , value ? : TYPE } [] , any > ;
static firstFulfilled < TYPE > (promises : ಠ_ಠ.clutz.goog.uri.utils.QueryArray ) : ಠ_ಠ.clutz.goog.Promise < TYPE , any > ;
static race < TYPE > (promises : ಠ_ಠ.clutz.goog.uri.utils.QueryArray ) : ಠ_ಠ.clutz.goog.Promise < TYPE , any > ;
static reject (opt_reason ? : any ) : ಠ_ಠ.clutz.goog.Promise < any , any > ;
static resolve < T >(value: Promise < T > | T): Promise < T >;
/**
* Sets a handler that will be called with reasons from unhandled rejected
* Promises. If the rejected Promise (or one of its descendants) has an
* {@code onRejected} callback registered, the rejection will be considered
* handled, and the rejection handler will not be called.
*
* By default, unhandled rejections are rethrown so that the error may be
* captured by the developer console or a {@code window.onerror} handler.
* @param handler A function that will be called with reasons from rejected Promises. Defaults to {@code goog.async.throwException}.
*/
static setUnhandledRejectionHandler (handler : (a : any ) => any ) : void ;
static withResolver < TYPE > ( ) : ಠ_ಠ.clutz.goog.promise.Resolver < TYPE > ;
}
class Promise_Instance < TYPE , RESOLVER_CONTEXT > implements ಠ_ಠ.clutz.goog.Thenable < TYPE > {
private noStructuralTyping_: any;
/**
* NOTE: This class was created in anticipation of the built-in Promise type
* being standardized and implemented across browsers. Now that Promise is
* available in modern browsers, and is automatically polyfilled by the Closure
* Compiler, by default, most new code should use native {@code Promise}
* instead of {@code goog.Promise}. However, {@code goog.Promise} has the
* concept of cancellation which native Promises do not yet have. So code
* needing cancellation may still want to use {@code goog.Promise}.
*
* Promises provide a result that may be resolved asynchronously. A Promise may
* be resolved by being fulfilled with a fulfillment value, rejected with a
* rejection reason, or blocked by another Promise. A Promise is said to be
* settled if it is either fulfilled or rejected. Once settled, the Promise
* result is immutable.
*
* Promises may represent results of any type, including undefined. Rejection
* reasons are typically Errors, but may also be of any type. Closure Promises
* allow for optional type annotations that enforce that fulfillment values are
* of the appropriate types at compile time.
*
* The result of a Promise is accessible by calling {@code then} and registering
* {@code onFulfilled} and {@code onRejected} callbacks. Once the Promise
* is settled, the relevant callbacks are invoked with the fulfillment value or
* rejection reason as argument. Callbacks are always invoked in the order they
* were registered, even when additional {@code then} calls are made from inside
* another callback. A callback is always run asynchronously sometime after the
* scope containing the registering {@code then} invocation has returned.
*
* If a Promise is resolved with another Promise, the first Promise will block
* until the second is settled, and then assumes the same result as the second
* Promise. This allows Promises to depend on the results of other Promises,
* linking together multiple asynchronous operations.
*
* This implementation is compatible with the Promises/A+ specification and
* passes that specification's conformance test suite. A Closure Promise may be
* resolved with a Promise instance (or sufficiently compatible Promise-like
* object) created by other Promise implementations. From the specification,
* Promise-like objects are known as "Thenables".
* @param resolver Initialization function that is invoked immediately with {@code resolve} and {@code reject} functions as arguments. The Promise is resolved or rejected with the first argument passed to either function.
* @param opt_context An optional context for executing the resolver function. If unspecified, the resolver function will be executed in the default scope.
*/
constructor (resolver : (a : (a ? : TYPE | PromiseLike < TYPE > | null | { then : any } ) => any , b : (a ? : any ) => any ) => void , opt_context ? : RESOLVER_CONTEXT ) ;
/**
* Cancels the Promise if it is still pending by rejecting it with a cancel
* Error. No action is performed if the Promise is already resolved.
*
* All child Promises of the canceled Promise will be rejected with the same
* cancel error, as with normal Promise rejection. If the Promise to be canceled
* is the only child of a pending Promise, the parent Promise will also be
* canceled. Cancellation may propagate upward through multiple generations.
* @param opt_message An optional debugging message for describing the cancellation reason.
*/
cancel (opt_message ? : string ) : void ;
/**
* Adds callbacks that will operate on the result of the Promise, returning a
* new child Promise.
*
* If the Promise is fulfilled, the {@code onFulfilled} callback will be invoked
* with the fulfillment value as argument, and the child Promise will be
* fulfilled with the return value of the callback. If the callback throws an
* exception, the child Promise will be rejected with the thrown value instead.
*
* If the Promise is rejected, the {@code onRejected} callback will be invoked
* with the rejection reason as argument, and the child Promise will be resolved
* with the return value or rejected with the thrown value of the callback.
*/
then < RESULT > (opt_onFulfilled ? : ( (a : RESOLVER_CONTEXT ) => Promise < RESULT > | RESULT ) | null , opt_onRejected ? : ( (a : any ) => any ) | null) : Promise < RESULT > ;
/**
* Adds a callback that will be invoked when the Promise is settled (fulfilled
* or rejected). The callback receives no argument, and no new child Promise is
* created. This is useful for ensuring that cleanup takes place after certain
* asynchronous operations. Callbacks added with {@code thenAlways} will be
* executed in the same order with other calls to {@code then},
* {@code thenAlways}, or {@code thenCatch}.
*
* Since it does not produce a new child Promise, cancellation propagation is
* not prevented by adding callbacks with {@code thenAlways}. A Promise that has
* a cleanup handler added with {@code thenAlways} will be canceled if all of
* its children created by {@code then} (or {@code thenCatch}) are canceled.
* Additionally, since any rejections are not passed to the callback, it does
* not stop the unhandled rejection handler from running.
* @param onSettled A function that will be invoked when the Promise is settled (fulfilled or rejected).
* @param opt_context An optional context object that will be the execution context for the callbacks. By default, functions are executed in the global scope.
*/
thenAlways < THIS > (onSettled : ( ) => void , opt_context ? : THIS ) : ಠ_ಠ.clutz.goog.Promise < TYPE , any > ;
/**
* Adds a callback that will be invoked only if the Promise is rejected. This
* is equivalent to {@code then(null, onRejected)}.
* @param onRejected A function that will be invoked with the rejection reason if the Promise is rejected.
* @param opt_context An optional context object that will be the execution context for the callbacks. By default, functions are executed in the global scope.
*/
thenCatch < THIS > (onRejected : (a : any ) => any , opt_context ? : THIS ) : ಠ_ಠ.clutz.goog.Promise < any , any > ;
/**
* Adds callbacks that will operate on the result of the Promise without
* returning a child Promise (unlike "then").
*
* If the Promise is fulfilled, the {@code onFulfilled} callback will be invoked
* with the fulfillment value as argument.
*
* If the Promise is rejected, the {@code onRejected} callback will be invoked
* with the rejection reason as argument.
* @param opt_onFulfilled A function that will be invoked with the fulfillment value if the Promise is fulfilled.
* @param opt_onRejected A function that will be invoked with the rejection reason if the Promise is rejected.
* @param opt_context An optional context object that will be the execution context for the callbacks. By default, functions are executed with the default this.
*/
thenVoid < THIS > (opt_onFulfilled ? : ( (a : TYPE ) => any ) | null , opt_onRejected ? : ( (a : any ) => any ) | null , opt_context ? : THIS ) : void ;
}
}
declare namespace ಠ_ಠ.clutz.goog.Promise {
class CallbackEntry_ extends CallbackEntry__Instance {
}
class CallbackEntry__Instance {
private noStructuralTyping_: any;
/**
* A boolean value to indicate this is a "thenAlways" callback entry.
* Unlike a normal "then/thenVoid" a "thenAlways doesn't participate
* in "cancel" considerations but is simply an observer and requires
* special handling.
*/
always : boolean ;
child : ಠ_ಠ.clutz.goog.Promise < any , any > | null ;
context : any ;
next : ಠ_ಠ.clutz.goog.Promise.CallbackEntry_ | null ;
onFulfilled : Function | null ;
onRejected : Function | null ;
/**
* clear the object prior to reuse
*/
reset ( ) : void ;
}
class CancellationError extends CancellationError_Instance {
}
class CancellationError_Instance extends ಠ_ಠ.clutz.goog.debug.Error_Instance {
/**
* Error used as a rejection reason for canceled Promises.
*/
constructor (opt_message ? : string ) ;
}
class Resolver_ < TYPE > extends Resolver__Instance < TYPE > {
}
class Resolver__Instance < TYPE > implements ಠ_ಠ.clutz.goog.promise.Resolver < TYPE > {
private noStructuralTyping_: any;
promise : ಠ_ಠ.clutz.goog.Promise < TYPE , any > ;
reject (a ? : any ) : void ;
resolve (a ? : TYPE | ಠ_ಠ.clutz.goog.Promise < TYPE , any > | null | { then : any } ) : any ;
}
}
declare module 'goog:goog.Promise' {
import alias = ಠ_ಠ.clutz.goog.Promise;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog {
/**
* Provides a more strict interface for Thenables in terms of
* http://promisesaplus.com for interop with {@see goog.Promise}.
*/
interface Thenable < TYPE > extends PromiseLike < TYPE > {
/**
* Adds callbacks that will operate on the result of the Thenable, returning a
* new child Promise.
*
* If the Thenable is fulfilled, the {@code onFulfilled} callback will be
* invoked with the fulfillment value as argument, and the child Promise will
* be fulfilled with the return value of the callback. If the callback throws
* an exception, the child Promise will be rejected with the thrown value
* instead.
*
* If the Thenable is rejected, the {@code onRejected} callback will be invoked
* with the rejection reason as argument, and the child Promise will be rejected
* with the return value of the callback or thrown value.
* @param opt_onFulfilled A function that will be invoked with the fulfillment value if the Promise is fulfilled.
* @param opt_onRejected A function that will be invoked with the rejection reason if the Promise is rejected.
* @param opt_context An optional context object that will be the execution context for the callbacks. By default, functions are executed with the default this.
*/
then < RESULT > (opt_onFulfilled ? : ( (a : TYPE ) => Thenable < RESULT > | RESULT ) | null , opt_onRejected ? : ( (a : any ) => any ) | null) : Thenable < RESULT > ;
}
}
declare namespace ಠ_ಠ.clutz.goog.Thenable {
var IMPLEMENTED_BY_PROP : string ;
function addImplementation (ctor : { new ( ...a : any [] ) : ಠ_ಠ.clutz.goog.Thenable < any > } ) : void ;
function isImplementedBy (object : any ) : boolean ;
}
declare module 'goog:goog.Thenable' {
import alias = ಠ_ಠ.clutz.goog.Thenable;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog {
/**
* Class for handling timing events.
*/
class Timer extends Timer_Instance {
/**
* Constant for the timer's event type.
*/
static TICK : string ;
/**
* Calls the given function once, after the optional pause.
* <p>
* The function is always called asynchronously, even if the delay is 0. This
* is a common trick to schedule a function to run after a batch of browser
* event processing.
* @param listener Function or object that has a handleEvent method.
* @param opt_delay Milliseconds to wait; default is 0.
* @param opt_handler Object in whose scope to call the listener.
*/
static callOnce < SCOPE > (listener : ( ( ) => any ) | { handleEvent : ( ) => any } | null , opt_delay ? : number , opt_handler ? : SCOPE ) : number ;
/**
* Clears a timeout initiated by {@link #callOnce}.
* @param timerId A timer ID.
*/
static clear (timerId : number | null ) : void ;
/**
* An object that implements {@code setTimeout}, {@code setInterval},
* {@code clearTimeout} and {@code clearInterval}. We default to the global
* object. Changing {@code goog.Timer.defaultTimerObject} changes the object for
* all timer instances which can be useful if your environment has some other
* implementation of timers you'd like to use.
*/
static defaultTimerObject : { clearTimeout : any , setTimeout : any } ;
/**
* Variable that controls the timer error correction. If the timer is called
* before the requested interval times {@code intervalScale}, which often
* happens on Mozilla, the timer is rescheduled.
*/
static intervalScale : number ;
static promise < RESULT > (delay : number , opt_result ? : RESULT | ಠ_ಠ.clutz.goog.Thenable < RESULT > | null | { then : any } ) : ಠ_ಠ.clutz.goog.Promise < RESULT , any > ;
}
class Timer_Instance extends ಠ_ಠ.clutz.goog.events.EventTarget_Instance {
/**
* Class for handling timing events.
* @param opt_interval Number of ms between ticks (default: 1ms).
* @param opt_timerObject An object that has {@code setTimeout}, {@code setInterval}, {@code clearTimeout} and {@code clearInterval} (e.g., {@code window}).
*/
constructor (opt_interval ? : number , opt_timerObject ? : GlobalObject | null ) ;
/**
* Dispatches the TICK event. This is its own method so subclasses can override.
*/
dispatchTick ( ) : void ;
disposeInternal ( ) : void ;
/**
* Whether this timer is enabled
*/
enabled : boolean ;
/**
* Gets the interval of the timer.
*/
getInterval ( ) : number ;
/**
* Sets the interval of the timer.
* @param interval Number of ms between ticks.
*/
setInterval (interval : number ) : void ;
/**
* Starts the timer.
*/
start ( ) : void ;
/**
* Stops the timer.
*/
stop ( ) : void ;
}
}
declare module 'goog:goog.Timer' {
import alias = ಠ_ಠ.clutz.goog.Timer;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.array {
var ASSUME_NATIVE_FUNCTIONS : boolean ;
/**
* Inserts a value into a sorted array. The array is not modified if the
* value is already present.
* @param array The array to modify.
* @param value The object to insert.
* @param opt_compareFn Optional comparison function by which the array is ordered. Should take 2 arguments to compare, and return a negative number, zero, or a positive number depending on whether the first argument is less than, equal to, or greater than the second.
*/
function binaryInsert < VALUE > (array : ArrayLike < VALUE > | null , value : VALUE , opt_compareFn ? : (a : VALUE , b : VALUE ) => number ) : boolean ;
/**
* Removes a value from a sorted array.
* @param array The array to modify.
* @param value The object to remove.
* @param opt_compareFn Optional comparison function by which the array is ordered. Should take 2 arguments to compare, and return a negative number, zero, or a positive number depending on whether the first argument is less than, equal to, or greater than the second.
*/
function binaryRemove < VALUE > (array : ArrayLike < VALUE > , value : VALUE , opt_compareFn ? : (a : VALUE , b : VALUE ) => number ) : boolean ;
/**
* Searches the specified array for the specified target using the binary
* search algorithm. If no opt_compareFn is specified, elements are compared
* using <code>goog.array.defaultCompare</code>, which compares the elements
* using the built in < and > operators. This will produce the expected
* behavior for homogeneous arrays of String(s) and Number(s). The array
* specified <b>must</b> be sorted in ascending order (as defined by the
* comparison function). If the array is not sorted, results are undefined.
* If the array contains multiple instances of the specified target value, any
* of these instances may be found.
*
* Runtime: O(log n)
* @param arr The array to be searched.
* @param target The sought value.
* @param opt_compareFn Optional comparison function by which the array is ordered. Should take 2 arguments to compare, and return a negative number, zero, or a positive number depending on whether the first argument is less than, equal to, or greater than the second.
*/
function binarySearch < TARGET , VALUE > (arr : ArrayLike < VALUE > | null , target : TARGET , opt_compareFn ? : (a : TARGET , b : VALUE ) => number ) : number ;
/**
* Selects an index in the specified array using the binary search algorithm.
* The evaluator receives an element and determines whether the desired index
* is before, at, or after it. The evaluator must be consistent (formally,
* goog.array.map(goog.array.map(arr, evaluator, opt_obj), goog.math.sign)
* must be monotonically non-increasing).
*
* Runtime: O(log n)
* @param arr The array to be searched.
* @param evaluator Evaluator function that receives 3 arguments (the element, the index and the array). Should return a negative number, zero, or a positive number depending on whether the desired index is before, at, or after the element passed to it.
* @param opt_obj The object to be used as the value of 'this' within evaluator.
*/
function binarySelect < THIS , VALUE > (arr : ArrayLike < VALUE > | null , evaluator : (a : VALUE , b : number , c : any ) => number , opt_obj ? : THIS ) : number ;
/**
* Splits an array into disjoint buckets according to a splitting function.
* @param array The array.
* @param sorter Function to call for every element. This takes 3 arguments (the element, the index and the array) and must return a valid object key (a string, number, etc), or undefined, if that object should not be placed in a bucket.
* @param opt_obj The object to be used as the value of 'this' within sorter.
*/
function bucket < T , S > (array : T [] | null , sorter : (a : T , b : number , c : T [] ) => any , opt_obj ? : S ) : { [ /* warning: coerced from ? */ key: string ]: T [] } ;
/**
* Clears the array.
* @param arr Array or array like object to clear.
*/
function clear (arr : ArrayLike < any > | null ) : void ;
/**
* Does a shallow copy of an array.
* @param arr Array or array-like object to clone.
*/
function clone < T > (a : ArrayLike < T > | null | string ) : T [] ;
/**
* 3-way array compare function.
* @param arr1 The first array to compare.
* @param arr2 The second array to compare.
* @param opt_compareFn Optional comparison function by which the array is to be ordered. Should take 2 arguments to compare, and return a negative number, zero, or a positive number depending on whether the first argument is less than, equal to, or greater than the second.
*/
function compare3 < VALUE > (arr1 : ArrayLike < VALUE > , arr2 : ArrayLike < VALUE > , opt_compareFn ? : (a : VALUE , b : VALUE ) => number ) : number ;
/**
* Returns a new array that is the result of joining the arguments. If arrays
* are passed then their items are added, however, if non-arrays are passed they
* will be added to the return array as is.
*
* Note that ArrayLike objects will be added as is, rather than having their
* items added.
*
* goog.array.concat([1, 2], [3, 4]) -> [1, 2, 3, 4]
* goog.array.concat(0, [1, 2]) -> [0, 1, 2]
* goog.array.concat([1, 2], null) -> [1, 2, null]
*
* There is bug in all current versions of IE (6, 7 and 8) where arrays created
* in an iframe become corrupted soon (not immediately) after the iframe is
* destroyed. This is common if loading data via goog.net.IframeIo, for example.
* This corruption only affects the concat method which will start throwing
* Catastrophic Errors (#-2147418113).
*
* See http://endoflow.com/scratch/corrupted-arrays.html for a test case.
*
* Internally goog.array should use this, so that all methods will continue to
* work on these broken array objects.
* @param var_args Items to concatenate. Arrays will have each item added, while primitives and objects will be added as is.
*/
function concat ( ...var_args : any [] ) : any [] ;
/**
* Maps each element of the input array into zero or more elements of the output
* array.
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. This function takes 3 arguments (the element, the index and the array) and should return an array. The result will be used to extend a new array.
* @param opt_obj The object to be used as the value of 'this' within f.
*/
function concatMap < THIS , VALUE , RESULT > (arr : ArrayLike < VALUE > | string , f : (a : VALUE , b : number , c : any ) => RESULT [] , opt_obj ? : THIS ) : RESULT [] ;
/**
* Whether the array contains the given object.
* @param arr The array to test for the presence of the element.
* @param obj The object for which to test.
*/
function contains (arr : ArrayLike < any > | null | string , obj : any ) : boolean ;
/**
* Returns a new array of elements from arr, based on the indexes of elements
* provided by index_arr. For example, the result of index copying
* ['a', 'b', 'c'] with index_arr [1,0,0,2] is ['b', 'a', 'a', 'c'].
* @param arr The array to get a indexed copy from.
* @param index_arr An array of indexes to get from arr.
*/
function copyByIndex < T > (arr : T [] , index_arr : number [] ) : T [] ;
/**
* Counts the array elements that fulfill the predicate, i.e. for which the
* callback function returns true. Skips holes in the array.
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. Takes 3 arguments (the element, the index and the array).
* @param opt_obj The object to be used as the value of 'this' within f.
*/
function count < T , S > (arr : ArrayLike < T > | string , f : (a : T , b : number , c : any ) => boolean , opt_obj ? : S ) : number ;
/**
* Compares its two arguments for order, using the built in < and >
* operators.
* @param a The first object to be compared.
* @param b The second object to be compared.
*/
function defaultCompare < VALUE > (a : VALUE , b : VALUE ) : number ;
/**
* Compares its two arguments for equality, using the built in === operator.
* @param a The first object to compare.
* @param b The second object to compare.
*/
function defaultCompareEquality (a : any , b : any ) : boolean ;
/**
* Compares two arrays for equality. Two arrays are considered equal if they
* have the same length and their corresponding elements are equal according to
* the comparison function.
* @param arr1 The first array to compare.
* @param arr2 The second array to compare.
* @param opt_equalsFn Optional comparison function. Should take 2 arguments to compare, and return true if the arguments are equal. Defaults to {@link goog.array.defaultCompareEquality} which compares the elements using the built-in '===' operator.
*/
function equals (arr1 : ArrayLike < any > | null , arr2 : ArrayLike < any > | null , opt_equalsFn ? : Function | null ) : boolean ;
/**
* Call f for each element of an array. If all calls return true, every()
* returns true. If any call returns false, every() returns false and
* does not continue to check the remaining elements.
*
* See {@link http://tinyurl.com/developer-mozilla-org-array-every}
* @param arr Array or array like object over which to iterate.
* @param f The function to call for for every element. This function takes 3 arguments (the element, the index and the array) and should return a boolean.
* @param opt_obj The object to be used as the value of 'this' within f.
*/
function every < T , S > (a : ArrayLike < T > | null | string , b : ( (a : T , b : number , c : any ) => boolean ) | null , c ? : S ) : boolean ;
/**
* Extends an array with another array, element, or "array like" object.
* This function operates 'in-place', it does not create a new Array.
*
* Example:
* var a = [];
* goog.array.extend(a, [0, 1]);
* a; // [0, 1]
* goog.array.extend(a, 2);
* a; // [0, 1, 2]
* @param arr1 The array to modify.
* @param var_args The elements or arrays of elements to add to arr1.
*/
function extend < VALUE > (arr1 : VALUE [] | null , ...var_args : ( VALUE [] | null | VALUE | undefined ) [] ) : void ;
/**
* Calls a function for each element in an array, and if the function returns
* true adds the element to a new array.
*
* See {@link http://tinyurl.com/developer-mozilla-org-array-filter}
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. This function takes 3 arguments (the element, the index and the array) and must return a Boolean. If the return value is true the element is added to the result array. If it is false the element is not included.
* @param opt_obj The object to be used as the value of 'this' within f.
*/
function filter < T , S > (a : ArrayLike < T > | null | string , b : ( (a : T , b : number , c : any ) => boolean ) | null , c ? : S ) : T [] ;
/**
* Search an array for the first element that satisfies a given condition and
* return that element.
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. This function takes 3 arguments (the element, the index and the array) and should return a boolean.
* @param opt_obj An optional "this" context for the function.
*/
function find < T , S > (arr : ArrayLike < T > | null | string , f : ( (a : T , b : number , c : any ) => boolean ) | null , opt_obj ? : S ) : T | null ;
/**
* Search an array for the first element that satisfies a given condition and
* return its index.
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. This function takes 3 arguments (the element, the index and the array) and should return a boolean.
* @param opt_obj An optional "this" context for the function.
*/
function findIndex < T , S > (arr : ArrayLike < T > | null | string , f : ( (a : T , b : number , c : any ) => boolean ) | null , opt_obj ? : S ) : number ;
/**
* Search an array (in reverse order) for the last element that satisfies a
* given condition and return its index.
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. This function takes 3 arguments (the element, the index and the array) and should return a boolean.
* @param opt_obj An optional "this" context for the function.
*/
function findIndexRight < T , S > (arr : ArrayLike < T > | null | string , f : ( (a : T , b : number , c : any ) => boolean ) | null , opt_obj ? : S ) : number ;
/**
* Search an array (in reverse order) for the last element that satisfies a
* given condition and return that element.
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. This function takes 3 arguments (the element, the index and the array) and should return a boolean.
* @param opt_obj An optional "this" context for the function.
*/
function findRight < T , S > (arr : ArrayLike < T > | null | string , f : ( (a : T , b : number , c : any ) => boolean ) | null , opt_obj ? : S ) : T | null ;
/**
* Returns an array consisting of every argument with all arrays
* expanded in-place recursively.
* @param var_args The values to flatten.
*/
function flatten ( ...var_args : any [] ) : any [] ;
/**
* Calls a function for each element in an array. Skips holes in the array.
* See {@link http://tinyurl.com/developer-mozilla-org-array-foreach}
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. This function takes 3 arguments (the element, the index and the array). The return value is ignored.
* @param opt_obj The object to be used as the value of 'this' within f.
*/
function forEach < T , S > (a : ArrayLike < T > | null | string , b : ( (a : T , b : number , c : any ) => any ) | null , c ? : S ) : any ;
/**
* Calls a function for each element in an array, starting from the last
* element rather than the first.
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. This function takes 3 arguments (the element, the index and the array). The return value is ignored.
* @param opt_obj The object to be used as the value of 'this' within f.
*/
function forEachRight < T , S > (arr : ArrayLike < T > | null | string , f : ( (a : T , b : number , c : any ) => any ) | null , opt_obj ? : S ) : void ;
/**
* Returns the index of the first element of an array with a specified value, or
* -1 if the element is not present in the array.
*
* See {@link http://tinyurl.com/developer-mozilla-org-array-indexof}
* @param arr The array to be searched.
* @param obj The object for which we are searching.
* @param opt_fromIndex The index at which to start the search. If omitted the search starts at index 0.
*/
function indexOf < T > (a : ArrayLike < T > | null | string , b : T , c ? : number ) : number ;
/**
* Pushes an item into an array, if it's not already in the array.
* @param arr Array into which to insert the item.
* @param obj Value to add.
*/
function insert < T > (arr : T [] | null , obj : T ) : void ;
/**
* Inserts at the given index of the array, all elements of another array.
* @param arr The array to modify.
* @param elementsToAdd The array of elements to add.
* @param opt_i The index at which to insert the object. If omitted, treated as 0. A negative index is counted from the end of the array.
*/
function insertArrayAt (arr : ArrayLike < any > | null , elementsToAdd : ArrayLike < any > | null , opt_i ? : number ) : void ;
/**
* Inserts an object at the given index of the array.
* @param arr The array to modify.
* @param obj The object to insert.
* @param opt_i The index at which to insert the object. If omitted, treated as 0. A negative index is counted from the end of the array.
*/
function insertAt (arr : ArrayLike < any > | null , obj : any , opt_i ? : number ) : void ;
/**
* Inserts an object into an array before a specified object.
* @param arr The array to modify.
* @param obj The object to insert.
* @param opt_obj2 The object before which obj should be inserted. If obj2 is omitted or not found, obj is inserted at the end of the array.
*/
function insertBefore < T > (arr : T [] | null , obj : T , opt_obj2 ? : T ) : void ;
/**
* Compares its two arguments for inverse order, using the built in < and >
* operators.
* @param a The first object to be compared.
* @param b The second object to be compared.
*/
function inverseDefaultCompare < VALUE > (a : VALUE , b : VALUE ) : number ;
/**
* Whether the array is empty.
* @param arr The array to test.
*/
function isEmpty (arr : ArrayLike < any > | null | string ) : boolean ;
/**
* Tells if the array is sorted.
* @param arr The array.
* @param opt_compareFn Function to compare the array elements. Should take 2 arguments to compare, and return a negative number, zero, or a positive number depending on whether the first argument is less than, equal to, or greater than the second.
* @param opt_strict If true no equal elements are allowed.
*/
function isSorted < T > (arr : T [] , opt_compareFn ? : ( (a : T , b : T ) => number ) | null , opt_strict ? : boolean ) : boolean ;
/**
* Returns a new array that contains the contents of all the arrays passed.
*/
function join < T > ( ...var_args : ( T [] | undefined ) [] ) : T [] ;
/**
* Returns the last element in an array without removing it.
* Same as goog.array.peek.
* @param array The array.
*/
function last < T > (a : ArrayLike < T > | null | string ) : T ;
/**
* Returns the index of the last element of an array with a specified value, or
* -1 if the element is not present in the array.
*
* See {@link http://tinyurl.com/developer-mozilla-org-array-lastindexof}
* @param arr The array to be searched.
* @param obj The object for which we are searching.
* @param opt_fromIndex The index at which to start the search. If omitted the search starts at the end of the array.
*/
function lastIndexOf < T > (a : ArrayLike < T > | string , b : T , c ? : number | null ) : number ;
/**
* Calls a function for each element in an array and inserts the result into a
* new array.
*
* See {@link http://tinyurl.com/developer-mozilla-org-array-map}
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. This function takes 3 arguments (the element, the index and the array) and should return something. The result will be inserted into a new array.
* @param opt_obj The object to be used as the value of 'this' within f.
*/
function map < THIS , VALUE , RESULT > (a : ArrayLike < VALUE > | null | string , b : (a : VALUE , b : number , c : any ) => RESULT , c ? : THIS ) : RESULT [] ;
/**
* Moves one item of an array to a new position keeping the order of the rest
* of the items. Example use case: keeping a list of JavaScript objects
* synchronized with the corresponding list of DOM elements after one of the
* elements has been dragged to a new position.
* @param arr The array to modify.
* @param fromIndex Index of the item to move between 0 and {@code arr.length - 1}.
* @param toIndex Target index between 0 and {@code arr.length - 1}.
*/
function moveItem (arr : ArrayLike < any > , fromIndex : number , toIndex : number ) : void ;
/**
* Returns the last element in an array without removing it.
* Same as goog.array.last.
* @param array The array.
*/
function peek < T > (array : ArrayLike < T > | null | string ) : T ;
/**
* Creates a range of numbers in an arithmetic progression.
*
* Range takes 1, 2, or 3 arguments:
* <pre>
* range(5) is the same as range(0, 5, 1) and produces [0, 1, 2, 3, 4]
* range(2, 5) is the same as range(2, 5, 1) and produces [2, 3, 4]
* range(-2, -5, -1) produces [-2, -3, -4]
* range(-2, -5, 1) produces [], since stepping by 1 wouldn't ever reach -5.
* </pre>
* @param startOrEnd The starting value of the range if an end argument is provided. Otherwise, the start value is 0, and this is the end value.
* @param opt_end The optional end value of the range.
* @param opt_step The step size between range values. Defaults to 1 if opt_step is undefined or 0.
*/
function range (startOrEnd : number , opt_end ? : number , opt_step ? : number ) : number [] ;
/**
* Passes every element of an array into a function and accumulates the result.
*
* See {@link http://tinyurl.com/developer-mozilla-org-array-reduce}
*
* For example:
* var a = [1, 2, 3, 4];
* goog.array.reduce(a, function(r, v, i, arr) {return r + v;}, 0);
* returns 10
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. This function takes 4 arguments (the function's previous result or the initial value, the value of the current array element, the current array index, and the array itself) function(previousValue, currentValue, index, array).
* @param val The initial value to pass into the function on the first call.
* @param opt_obj The object to be used as the value of 'this' within f.
*/
function reduce < T , S , R > (a : ArrayLike < T > | null | string , b : (a : R , b : T , c : number , d : any ) => R , c : any , d ? : S ) : R ;
/**
* Passes every element of an array into a function and accumulates the result,
* starting from the last element and working towards the first.
*
* See {@link http://tinyurl.com/developer-mozilla-org-array-reduceright}
*
* For example:
* var a = ['a', 'b', 'c'];
* goog.array.reduceRight(a, function(r, v, i, arr) {return r + v;}, '');
* returns 'cba'
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. This function takes 4 arguments (the function's previous result or the initial value, the value of the current array element, the current array index, and the array itself) function(previousValue, currentValue, index, array).
* @param val The initial value to pass into the function on the first call.
* @param opt_obj The object to be used as the value of 'this' within f.
*/
function reduceRight < T , S , R > (a : ArrayLike < T > | null | string , b : ( (a : R , b : T , c : number , d : any ) => R ) | null , c : any , d ? : S ) : R ;
/**
* Removes the first occurrence of a particular value from an array.
* @param arr Array from which to remove value.
* @param obj Object to remove.
*/
function remove < T > (arr : ArrayLike < T > | null , obj : T ) : boolean ;
/**
* Removes all values that satisfy the given condition.
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. This function takes 3 arguments (the element, the index and the array) and should return a boolean.
* @param opt_obj An optional "this" context for the function.
*/
function removeAllIf < T , S > (arr : ArrayLike < T > | null , f : ( (a : T , b : number , c : any ) => boolean ) | null , opt_obj ? : S ) : number ;
/**
* Removes from an array the element at index i
* @param arr Array or array like object from which to remove value.
* @param i The index to remove.
*/
function removeAt (arr : ArrayLike < any > | null , i : number ) : boolean ;
/**
* Removes all duplicates from an array (retaining only the first
* occurrence of each array element). This function modifies the
* array in place and doesn't change the order of the non-duplicate items.
*
* For objects, duplicates are identified as having the same unique ID as
* defined by {@link goog.getUid}.
*
* Alternatively you can specify a custom hash function that returns a unique
* value for each item in the array it should consider unique.
*
* Runtime: N,
* Worstcase space: 2N (no dupes)
* @param arr The array from which to remove duplicates.
* @param opt_rv An optional array in which to return the results, instead of performing the removal inplace. If specified, the original array will remain unchanged.
* @param opt_hashFn An optional function to use to apply to every item in the array. This function should return a unique value for each item in the array it should consider unique.
*/
function removeDuplicates < T > (arr : ArrayLike < T > | null , opt_rv ? : any [] | null , opt_hashFn ? : (a : T ) => string ) : void ;
/**
* Removes the first value that satisfies the given condition.
* @param arr Array or array like object over which to iterate.
* @param f The function to call for every element. This function takes 3 arguments (the element, the index and the array) and should return a boolean.
* @param opt_obj An optional "this" context for the function.
*/
function removeIf < T , S > (arr : ArrayLike < T > | null , f : ( (a : T , b : number , c : any ) => boolean ) | null , opt_obj ? : S ) : boolean ;
/**
* Removes the last occurrence of a particular value from an array.
* @param arr Array from which to remove value.
* @param obj Object to remove.
*/
function removeLast < T > (arr : ArrayLike < T > , obj : T ) : boolean ;
/**
* Returns an array consisting of the given value repeated N times.
* @param value The value to repeat.
* @param n The repeat count.
*/
function repeat < VALUE > (value : VALUE , n : number ) : VALUE [] ;
/**
* Rotates an array in-place. After calling this method, the element at
* index i will be the element previously at index (i - n) %
* array.length, for all values of i between 0 and array.length - 1,
* inclusive.
*
* For example, suppose list comprises [t, a, n, k, s]. After invoking
* rotate(array, 1) (or rotate(array, -4)), array will comprise [s, t, a, n, k].
* @param array The array to rotate.
* @param n The amount to rotate.
*/
function rotate < T > (array : T [] , n : number ) : T [] ;
/**
* Shuffles the values in the specified array using the Fisher-Yates in-place
* shuffle (also known as the Knuth Shuffle). By default, calls Math.random()
* and so resets the state of that random number generator. Similarly, may reset
* the state of the any other specified random number generator.
*
* Runtime: O(n)
* @param arr The array to be shuffled.
* @param opt_randFn Optional random function to use for shuffling. Takes no arguments, and returns a random number on the interval [0, 1). Defaults to Math.random() using JavaScript's built-in Math library.
*/
function shuffle (arr : any [] , opt_randFn ? : ( ) => number ) : void ;
/**
* Returns a new array from a segment of an array. This is a generic version of
* Array slice. This means that it might work on other objects similar to
* arrays, such as the arguments object.
* @param arr The array from which to copy a segment.
* @param start The index of the first element to copy.
* @param opt_end The index after the last element to copy.
*/
function slice < T > (arr : ArrayLike < T > | null | string , start : number , opt_end ? : number ) : T [] ;
/**
* Calls f for each element of an array. If any call returns true, some()
* returns true (without checking the remaining elements). If all calls
* return false, some() returns false.
*
* See {@link http://tinyurl.com/developer-mozilla-org-array-some}
* @param arr Array or array like object over which to iterate.
* @param f The function to call for for every element. This function takes 3 arguments (the element, the index and the array) and should return a boolean.
* @param opt_obj The object to be used as the value of 'this' within f.
*/
function some < T , S > (a : ArrayLike < T > | null | string , b : ( (a : T , b : number , c : any ) => boolean ) | null , c ? : S ) : boolean ;
/**
* Sorts the specified array into ascending order. If no opt_compareFn is
* specified, elements are compared using
* <code>goog.array.defaultCompare</code>, which compares the elements using
* the built in < and > operators. This will produce the expected behavior
* for homogeneous arrays of String(s) and Number(s), unlike the native sort,
* but will give unpredictable results for heterogeneous lists of strings and
* numbers with different numbers of digits.
*
* This sort is not guaranteed to be stable.
*
* Runtime: Same as <code>Array.prototype.sort</code>
* @param arr The array to be sorted.
* @param opt_compareFn Optional comparison function by which the array is to be ordered. Should take 2 arguments to compare, and return a negative number, zero, or a positive number depending on whether the first argument is less than, equal to, or greater than the second.
*/
function sort < T > (arr : T [] | null , opt_compareFn ? : ( (a : T , b : T ) => number ) | null ) : void ;
/**
* Sort the specified array into ascending order based on item keys
* returned by the specified key function.
* If no opt_compareFn is specified, the keys are compared in ascending order
* using <code>goog.array.defaultCompare</code>.
*
* Runtime: O(S(f(n)), where S is runtime of <code>goog.array.sort</code>
* and f(n) is runtime of the key function.
* @param arr The array to be sorted.
* @param keyFn Function taking array element and returning a key used for sorting this element.
* @param opt_compareFn Optional comparison function by which the keys are to be ordered. Should take 2 arguments to compare, and return a negative number, zero, or a positive number depending on whether the first argument is less than, equal to, or greater than the second.
*/
function sortByKey < T , K > (arr : T [] | null , keyFn : (a : T ) => K , opt_compareFn ? : ( (a : K , b : K ) => number ) | null ) : void ;
/**
* Sorts an array of objects by the specified object key and compare
* function. If no compare function is provided, the key values are
* compared in ascending order using <code>goog.array.defaultCompare</code>.
* This won't work for keys that get renamed by the compiler. So use
* {'foo': 1, 'bar': 2} rather than {foo: 1, bar: 2}.
* @param arr An array of objects to sort.
* @param key The object key to sort by.
* @param opt_compareFn The function to use to compare key values.
*/
function sortObjectsByKey (arr : ( GlobalObject | null ) [] | null , key : string , opt_compareFn ? : Function | null ) : void ;
/**
* Adds or removes elements from an array. This is a generic version of Array
* splice. This means that it might work on other objects similar to arrays,
* such as the arguments object.
* @param arr The array to modify.
* @param index The index at which to start changing the array. If not defined, treated as 0.
* @param howMany How many elements to remove (0 means no removal. A value below 0 is treated as zero and so is any other non number. Numbers are floored).
* @param var_args Optional, additional elements to insert into the array.
*/
function splice < T > (arr : ArrayLike < T > | null , index : number | undefined , howMany : number , ...var_args : ( T | undefined ) [] ) : T [] ;
/**
* Sorts the specified array into ascending order in a stable way. If no
* opt_compareFn is specified, elements are compared using
* <code>goog.array.defaultCompare</code>, which compares the elements using
* the built in < and > operators. This will produce the expected behavior
* for homogeneous arrays of String(s) and Number(s).
*
* Runtime: Same as <code>Array.prototype.sort</code>, plus an additional
* O(n) overhead of copying the array twice.
* @param arr The array to be sorted.
* @param opt_compareFn Optional comparison function by which the array is to be ordered. Should take 2 arguments to compare, and return a negative number, zero, or a positive number depending on whether the first argument is less than, equal to, or greater than the second.
*/
function stableSort < T > (arr : T [] | null , opt_compareFn ? : ( (a : T , b : T ) => number ) | null ) : void ;
/**
* Converts an object to an array.
* @param object The object to convert to an array.
*/
function toArray < T > (object : ArrayLike < T > | null | string ) : T [] ;
/**
* Creates a new object built from the provided array and the key-generation
* function.
* @param arr Array or array like object over which to iterate whose elements will be the values in the new object.
* @param keyFunc The function to call for every element. This function takes 3 arguments (the element, the index and the array) and should return a string that will be used as the key for the element in the new object. If the function returns the same key for more than one element, the value for that key is implementation-defined.
* @param opt_obj The object to be used as the value of 'this' within keyFunc.
*/
function toObject < T , S > (arr : ArrayLike < T > | null , keyFunc : ( (a : T , b : number , c : any ) => string ) | null , opt_obj ? : S ) : { [ /* warning: coerced from ? */ key: string ]: T } ;
/**
* Creates a new array for which the element at position i is an array of the
* ith element of the provided arrays. The returned array will only be as long
* as the shortest array provided; additional values are ignored. For example,
* the result of zipping [1, 2] and [3, 4, 5] is [[1,3], [2, 4]].
*
* This is similar to the zip() function in Python. See {@link
* http://docs.python.org/library/functions.html#zip}
* @param var_args Arrays to be combined.
*/
function zip ( ...var_args : ( ArrayLike < any > | undefined ) [] ) : any [] [] ;
}
declare module 'goog:goog.array' {
import alias = ಠ_ಠ.clutz.goog.array;
export = alias;
}
declare namespace ಠ_ಠ.clutz.goog.asserts {
/**
* The default error handler.
* @param e The exception to be handled.
*/
function DEFAULT_ERROR_HANDLER (e : ಠ_ಠ.clutz.goog.asserts.AssertionError ) : any ;
var ENABLE_ASSERTS : boolean ;
/**
* Checks if the condition evaluates to true if goog.asserts.ENABLE_ASSERTS is
* true.
* @param condition The condition to check.
* @param opt_message Error message in case of failure.
* @param var_args The items to substitute into the failure message.
*/
function assert < T > (condition : T , opt_message ? : string , ...var_args : any [] ) : T ;
/**
* Checks if the value is an Array if goog.asserts.ENABLE_ASSERTS is true.
* @param value The value to check.
* @param opt_message Error message in case of failure.
* @param var_args The items to substitute into the failure message.
*/
function assertArray (value : any , opt_message ? : string , ...var_args : any [] ) : any [] ;
/**
* Checks if the value is a boolean if goog.asserts.ENABLE_ASSERTS is true.
* @param value The value to check.
* @param opt_message Error message in case of failure.
* @param var_args The items to substitute into the failure message.
*/
function assertBoolean (value : any , opt_message ? : string , ...var_args : any [] ) : boolean ;
/**
* Checks if the value is a DOM Element if goog.asserts.ENABLE_ASSERTS is true.
* @param value The value to check.
* @param opt_message Error message in case of failure.
* @param var_args The items to substitute into the failure message.
*/
function assertElement (value : any , opt_message ? : string , ...var_args : any [] ) : Element ;
/**
* Checks whether the value is a finite number, if goog.asserts.ENABLE_ASSERTS
* is true.
* @param value The value to check.
* @param opt_message Error message in case of failure.
* @param var_args The items to substitute into the failure message.
*/
function assertFinite (value : any , opt_message ? : string , ...var_args : any [] ) : number ;
/**
* Checks if the value is a function if goog.asserts.ENABLE_ASSERTS is true.
* @param value The value to check.
* @param opt_message Error message in case of failure.
* @param var_args The items to substitute into the failure message.
*/
function assertFunction (value : any , opt_message ? : string , ...var_args : any [] ) : Function ;
/**
* Checks if the value is an instance of the user-defined type if
* goog.asserts.ENABLE_ASSERTS is true.
*
* The compiler may tighten the type returned by this function.
* @param value The value to check.
* @param type A user-defined constructor.
* @param opt_message Error message in case of failure.
* @param var_args The items to substitute into the failure message.
*/
function assertInstanceof < T > (value : any , type : { new ( ...a : any [] ) : T } , opt_message ? : string , ...var_args : any [] ) : T ;
/**
* Checks if the value is a number if goog.asserts.ENABLE_ASSERTS is true.
* @param value The value to check.
* @param opt_message Error message in case of failure.
* @param var_args The items to substitute into the failure message.
*/
function assertNumber (value : any , opt_message ? : string , ...var_args : any [] ) : number ;
/**
* Checks if the value is an Object if goog.asserts.ENABLE_ASSERTS is true.
* @param value The value to check.
* @param opt_message Error message in case of failure.
* @param var_args The items to substitute into the failure message.
*/
function assertObject (value : any , opt_message ? : string , ...var_args : any [] ) : GlobalObject ;
/**
* Checks that no enumerable keys are present in Object.prototype. Such keys
* would break most code that use {@code for (var ... in ...)} loops.
*/
function assertObjectPrototypeIsIntact ( ) : void ;
/**
* Checks if the value is a string if goog.asserts.ENABLE_ASSERTS is true.
* @param value The value to check.
* @param opt_message Error message in case of failure.
* @param var_args The items to substitute into the failure message.
*/
function assertString (value : any , opt_message ? : string , ...var_args : any [] ) : string ;
/**
* Fails if goog.asserts.ENABLE_ASSERTS is true. This function is useful in case
* when we want to add a check in the unreachable area like switch-case
* statement:
*
* <pre>
* switch(type) {
* case FOO: doSomething(); break;
* case BAR: doSomethingElse(); break;
* default: goog.asserts.fail('Unrecognized type: ' + type);
* // We have only 2 types - "default:" section is unreachable code.
* }
* </pre>
* @param opt_message Error message in case of failure.
* @param var_args The items to substitute into the failure message.
*/
function fail (opt_message ? : string , ...var_args : any [] ) : void ;
/**
* Sets a custom error handler that can be used to customize the behavior of
* assertion failures, for example by turning all assertion failures into log
* messages.
*/
function setErrorHandler (errorHandler : (a : ಠ_ಠ.clutz.goog.asserts.AssertionError ) => any ) : void ;
}
declare module 'goog:goog.asserts' {
import alias = ಠ_ಠ.clutz.goog.asserts;
export = alias;
}
declare namespace ಠ_ಠ.clutz.goog.asserts {
/**
* Error object for failed assertions.
*/
class AssertionError extends AssertionError_Instance {
}
class AssertionError_Instance extends ಠ_ಠ.clutz.goog.debug.Error_Instance {
/**
* Error object for failed assertions.
* @param messagePattern The pattern that was used to form message.
* @param messageArgs The items to substitute into the pattern.
*/
constructor (messagePattern : string , messageArgs : ಠ_ಠ.clutz.goog.uri.utils.QueryArray ) ;
/**
* The message pattern used to format the error message. Error handlers can
* use this to uniquely identify the assertion.
*/
messagePattern : string ;
}
}
declare module 'goog:goog.asserts.AssertionError' {
import alias = ಠ_ಠ.clutz.goog.asserts.AssertionError;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.async {
class FreeList < ITEM > extends FreeList_Instance < ITEM > {
}
class FreeList_Instance < ITEM > {
private noStructuralTyping_: any;
constructor (create : ( ) => ITEM , reset : (a : ITEM ) => void , limit : number ) ;
get ( ) : ITEM ;
/**
* Visible for testing.
*/
occupants ( ) : number ;
put (item : ITEM ) : void ;
}
}
declare module 'goog:goog.async.FreeList' {
import alias = ಠ_ಠ.clutz.goog.async.FreeList;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.async {
class WorkItem extends WorkItem_Instance {
}
class WorkItem_Instance {
private noStructuralTyping_: any;
fn : ( ( ) => any ) | null ;
next : ಠ_ಠ.clutz.goog.async.WorkItem | null ;
scope ? : GlobalObject | null ;
/**
* Reset the work item so they don't prevent GC before reuse
*/
reset ( ) : void ;
set (fn : ( ) => any , scope : GlobalObject | null | undefined ) : void ;
}
}
declare module 'goog:goog.async.WorkItem' {
import alias = ಠ_ಠ.clutz.goog.async.WorkItem;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.async {
/**
* A low GC workqueue. The key elements of this design:
* - avoids the need for goog.bind or equivalent by carrying scope
* - avoids the need for array reallocation by using a linked list
* - minimizes work entry objects allocation by recycling objects
*/
class WorkQueue extends WorkQueue_Instance {
static DEFAULT_MAX_UNUSED : number ;
}
class WorkQueue_Instance {
private noStructuralTyping_: any;
workHead_ : null | ಠ_ಠ.clutz.goog.async.WorkItem ;
workTail_ : null | ಠ_ಠ.clutz.goog.async.WorkItem ;
add (fn : ( ) => any , scope : GlobalObject | null | undefined ) : void ;
remove ( ) : ಠ_ಠ.clutz.goog.async.WorkItem | null ;
returnUnused (item : ಠ_ಠ.clutz.goog.async.WorkItem | null ) : void ;
}
}
declare module 'goog:goog.async.WorkQueue' {
import alias = ಠ_ಠ.clutz.goog.async.WorkQueue;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.async {
/**
* Fires the provided callbacks as soon as possible after the current JS
* execution context. setTimeout(…, 0) takes at least 4ms when called from
* within another setTimeout(…, 0) for legacy reasons.
*
* This will not schedule the callback as a microtask (i.e. a task that can
* preempt user input or networking callbacks). It is meant to emulate what
* setTimeout(_, 0) would do if it were not throttled. If you desire microtask
* behavior, use {@see goog.Promise} instead.
* @param callback Callback function to fire as soon as possible.
* @param opt_context Object in whose scope to call the listener.
* @param opt_useSetImmediate Avoid the IE workaround that ensures correctness at the cost of speed. See comments for details.
*/
function nextTick < SCOPE > (callback : ( ) => any , opt_context ? : SCOPE , opt_useSetImmediate ? : boolean ) : void ;
}
declare module 'goog:goog.async.nextTick' {
import alias = ಠ_ಠ.clutz.goog.async.nextTick;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.async {
/**
* Fires the provided callback just before the current callstack unwinds, or as
* soon as possible after the current JS execution context.
* @param opt_context Object to use as the "this value" when calling the provided function.
*/
function run < THIS > (callback : ( ) => any , opt_context ? : THIS ) : void ;
}
declare module 'goog:goog.async.run' {
import alias = ಠ_ಠ.clutz.goog.async.run;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.async {
/**
* Throw an item without interrupting the current execution context. For
* example, if processing a group of items in a loop, sometimes it is useful
* to report an error while still allowing the rest of the batch to be
* processed.
*/
function throwException (exception : any ) : void ;
}
declare module 'goog:goog.async.throwException' {
import alias = ಠ_ಠ.clutz.goog.async.throwException;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.debug {
var FORCE_SLOPPY_STACKS : boolean ;
var LOGGING_ENABLED : boolean ;
/**
* Max length of stack to try and output
*/
var MAX_STACK_DEPTH : number ;
/**
* Catches onerror events fired by windows and similar objects.
* @param logFunc The function to call with the error information.
* @param opt_cancel Whether to stop the error from reaching the browser.
* @param opt_target Object that fires onerror events.
*/
function catchErrors (logFunc : (a : GlobalObject | null ) => any , opt_cancel ? : boolean , opt_target ? : GlobalObject | null ) : void ;
/**
* Creates a string representing a given primitive or object, and for an
* object, all its properties and nested objects. NOTE: The output will include
* Uids on all objects that were exposed. Any added Uids will be removed before
* returning.
* @param obj Object to expose.
* @param opt_showFn Also show properties that are functions (by default, functions are omitted).
*/
function deepExpose (obj : any , opt_showFn ? : boolean ) : string ;
/**
* Converts an object to an Error using the object's toString if it's not
* already an Error, adds a stacktrace if there isn't one, and optionally adds
* an extra message.
* @param err The original thrown error, object, or string.
* @param opt_message optional additional message to add to the error.
*/
function enhanceError (err : any , opt_message ? : string ) : GlobalError ;
/**
* Converts an object to an Error using the object's toString if it's not
* already an Error, adds a stacktrace if there isn't one, and optionally adds
* context to the Error, which is reported by the closure error reporter.
* @param err The original thrown error, object, or string.
* @param opt_context Key-value context to add to the Error.
*/
function enhanceErrorWithContext (err : any , opt_context ? : { [ key: string ]: string } ) : GlobalError ;
/**
* Creates a string representing an object and all its properties.
* @param obj Object to expose.
* @param opt_showFn Show the functions as well as the properties, default is false.
*/
function expose (obj : GlobalObject | null | undefined , opt_showFn ? : boolean ) : string ;
/**
* Recursively outputs a nested array as a string.
* @param arr The array.
*/
function exposeArray (arr : any [] | null ) : string ;
/**
* Freezes the given object, but only in debug mode (and in browsers that
* support it). Note that this is a shallow freeze, so for deeply nested
* objects it must be called at every level to ensure deep immutability.
*/
function freeze < T > (arg : T ) : T ;
/**
* Gets a function name
* @param fn Function to get name of.
*/
function getFunctionName (fn : Function | null ) : string ;
/**
* Gets the current stack trace, either starting from the caller or starting
* from a specified function that's currently on the call stack.
* @param fn If provided, when collecting the stack trace all frames above the topmost call to this function, including that call, will be left out of the stack trace.
*/
function getStacktrace (fn ? : Function | null ) : string ;
/**
* Gets the current stack trace. Simple and iterative - doesn't worry about
* catching circular references or getting the args.
* @param opt_depth Optional maximum depth to trace back to.
*/
function getStacktraceSimple (opt_depth ? : number ) : string ;
/**
* Makes whitespace visible by replacing it with printable characters.
* This is useful in finding diffrences between the expected and the actual
* output strings of a testcase.
* @param string whose whitespace needs to be made visible.
*/
function makeWhitespaceVisible (string : string ) : string ;
/**
* Normalizes the error/exception object between browsers.
* @param err Raw error object.
*/
function normalizeErrorObject (err : any ) : { fileName ? : any , lineNumber ? : any , message ? : any , name ? : any , stack ? : any } ;
/**
* Returns the type of a value. If a constructor is passed, and a suitable
* string cannot be found, 'unknown type name' will be returned.
*
* <p>Forked rather than moved from {@link goog.asserts.getType_}
* to avoid adding a dependency to goog.asserts.
* @param value A constructor, object, or primitive.
*/
function runtimeType (value : any ) : string ;
/**
* Set a custom function name resolver.
* @param resolver Resolves functions to their names.
*/
function setFunctionResolver (resolver : (a : Function | null ) => string ) : void ;
}
declare module 'goog:goog.debug' {
import alias = ಠ_ಠ.clutz.goog.debug;
export = alias;
}
declare namespace ಠ_ಠ.clutz.goog.debug {
interface EntryPointMonitor {
/**
* Try to remove an instrumentation wrapper created by this monitor.
* If the function passed to unwrap is not a wrapper created by this
* monitor, then we will do nothing.
*
* Notice that some wrappers may not be unwrappable. For example, if other
* monitors have applied their own wrappers, then it will be impossible to
* unwrap them because their wrappers will have captured our wrapper.
*
* So it is important that entry points are unwrapped in the reverse
* order that they were wrapped.
* @param fn A function to unwrap.
*/
unwrap (a : Function ) : Function ;
/**
* Instruments a function.
* @param fn A function to instrument.
*/
wrap (a : Function ) : Function ;
}
}
declare module 'goog:goog.debug.EntryPointMonitor' {
import alias = ಠ_ಠ.clutz.goog.debug.EntryPointMonitor;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.debug {
/**
* Base class for custom error objects.
*/
class Error extends Error_Instance {
}
class Error_Instance extends GlobalError {
/**
* Base class for custom error objects.
* @param opt_msg The message associated with the error.
*/
constructor (opt_msg ? : any ) ;
message : string ;
/**
* Whether to report this error to the server. Setting this to false will
* cause the error reporter to not report the error back to the server,
* which can be useful if the client knows that the error has already been
* logged on the server.
*/
reportErrorToServer : boolean ;
stack : string ;
}
}
declare module 'goog:goog.debug.Error' {
import alias = ಠ_ಠ.clutz.goog.debug.Error;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.debug {
/**
* Creates the log buffer.
*/
class LogBuffer extends LogBuffer_Instance {
static CAPACITY : number ;
/**
* A static method that always returns the same instance of LogBuffer.
*/
static getInstance ( ) : ಠ_ಠ.clutz.goog.debug.LogBuffer ;
static instance_ : ಠ_ಠ.clutz.goog.debug.LogBuffer ;
static isBufferingEnabled ( ) : boolean ;
}
class LogBuffer_Instance {
private noStructuralTyping_: any;
/**
* Adds a log record to the buffer, possibly overwriting the oldest record.
* @param level One of the level identifiers.
* @param msg The string message.
* @param loggerName The name of the source logger.
*/
addRecord (level : ಠ_ಠ.clutz.goog.debug.Logger.Level | null , msg : string , loggerName : string ) : ಠ_ಠ.clutz.goog.debug.LogRecord ;
/**
* Removes all buffered log records.
*/
clear ( ) : void ;
/**
* Calls the given function for each buffered log record, starting with the
* oldest one.
* @param func The function to call.
*/
forEachRecord (func : (a : ಠ_ಠ.clutz.goog.debug.LogRecord ) => any ) : void ;
}
}
declare module 'goog:goog.debug.LogBuffer' {
import alias = ಠ_ಠ.clutz.goog.debug.LogBuffer;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.debug.LogManager {
/**
* Creates a function that can be passed to goog.debug.catchErrors. The function
* will log all reported errors using the given logger.
* @param opt_logger The logger to log the errors to. Defaults to the root logger.
*/
function createFunctionForCatchErrors (opt_logger ? : ಠ_ಠ.clutz.goog.debug.Logger | null ) : (a : GlobalObject | null ) => any ;
/**
* Finds a named logger.
* @param name A name for the logger. This should be a dot-separated name and should normally be based on the package name or class name of the subsystem, such as goog.net.BrowserChannel.
*/
function getLogger (name : string ) : ಠ_ಠ.clutz.goog.debug.Logger ;
/**
* Returns all the loggers.
*/
function getLoggers ( ) : { [ key: string ]: ಠ_ಠ.clutz.goog.debug.Logger } ;
/**
* Returns the root of the logger tree namespace, the logger with the empty
* string as its name.
*/
function getRoot ( ) : ಠ_ಠ.clutz.goog.debug.Logger ;
/**
* Initializes the LogManager if not already initialized.
*/
function initialize ( ) : void ;
}
declare module 'goog:goog.debug.LogManager' {
import alias = ಠ_ಠ.clutz.goog.debug.LogManager;
export = alias;
}
declare namespace ಠ_ಠ.clutz.goog.debug {
/**
* LogRecord objects are used to pass logging requests between
* the logging framework and individual log Handlers.
*/
class LogRecord extends LogRecord_Instance {
static ENABLE_SEQUENCE_NUMBERS : boolean ;
}
class LogRecord_Instance {
private noStructuralTyping_: any;
/**
* LogRecord objects are used to pass logging requests between
* the logging framework and individual log Handlers.
* @param level One of the level identifiers.
* @param msg The string message.
* @param loggerName The name of the source logger.
* @param opt_time Time this log record was created if other than now. If 0, we use #goog.now.
* @param opt_sequenceNumber Sequence number of this log record. This should only be passed in when restoring a log record from persistence.
*/
constructor (level : ಠ_ಠ.clutz.goog.debug.Logger.Level | null , msg : string , loggerName : string , opt_time ? : number , opt_sequenceNumber ? : number ) ;
/**
* Get the exception that is part of the log record.
*/
getException ( ) : GlobalObject | null ;
/**
* Get the logging message level, for example Level.SEVERE.
*/
getLevel ( ) : ಠ_ಠ.clutz.goog.debug.Logger.Level | null ;
/**
* Get the source Logger's name.
*/
getLoggerName ( ) : string ;
/**
* Get the "raw" log message, before localization or formatting.
*/
getMessage ( ) : string ;
/**
* Get event time in milliseconds since 1970.
*/
getMillis ( ) : number ;
/**
* Get the sequence number.
* <p>
* Sequence numbers are normally assigned in the LogRecord
* constructor, which assigns unique sequence numbers to
* each new LogRecord in increasing order.
*/
getSequenceNumber ( ) : number ;
/**
* Sets all fields of the log record.
* @param level One of the level identifiers.
* @param msg The string message.
* @param loggerName The name of the source logger.
* @param opt_time Time this log record was created if other than now. If 0, we use #goog.now.
* @param opt_sequenceNumber Sequence number of this log record. This should only be passed in when restoring a log record from persistence.
*/
reset (level : ಠ_ಠ.clutz.goog.debug.Logger.Level | null , msg : string , loggerName : string , opt_time ? : number , opt_sequenceNumber ? : number ) : void ;
/**
* Set the exception that is part of the log record.
* @param exception the exception.
*/
setException (exception : GlobalObject | null ) : void ;
/**
* Set the logging message level, for example Level.SEVERE.
* @param level the logging message level.
*/
setLevel (level : ಠ_ಠ.clutz.goog.debug.Logger.Level | null ) : void ;
/**
* Get the source Logger's name.
* @param loggerName source logger name (may be null).
*/
setLoggerName (loggerName : string ) : void ;
/**
* Set the "raw" log message, before localization or formatting.
* @param msg the raw message string.
*/
setMessage (msg : string ) : void ;
/**
* Set event time in milliseconds since 1970.
* @param time event time in millis since 1970.
*/
setMillis (time : number ) : void ;
}
}
declare module 'goog:goog.debug.LogRecord' {
import alias = ಠ_ಠ.clutz.goog.debug.LogRecord;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.debug {
/**
* A message value that can be handled by a Logger.
*
* Functions are treated like callbacks, but are only called when the event's
* log level is enabled. This is useful for logging messages that are expensive
* to construct.
*/
type Loggable = string | ( ( ) => string ) ;
}
declare module 'goog:goog.debug.Loggable' {
import alias = ಠ_ಠ.clutz.goog.debug.Loggable;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.debug {
/**
* The Logger is an object used for logging debug messages. Loggers are
* normally named, using a hierarchical dot-separated namespace. Logger names
* can be arbitrary strings, but they should normally be based on the package
* name or class name of the logged component, such as goog.net.BrowserChannel.
*
* The Logger object is loosely based on the java class
* java.util.logging.Logger. It supports different levels of filtering for
* different loggers.
*
* The logger object should never be instantiated by application code. It
* should always use the goog.debug.Logger.getLogger function.
*/
class Logger extends Logger_Instance {
static ENABLE_HIERARCHY : boolean ;
static ENABLE_PROFILER_LOGGING : boolean ;
static ROOT_LOGGER_NAME : string ;
/**
* Finds or creates a logger for a named subsystem. If a logger has already been
* created with the given name it is returned. Otherwise a new logger is
* created. If a new logger is created its log level will be configured based
* on the LogManager configuration and it will configured to also send logging
* output to its parent's handlers. It will be registered in the LogManager
* global namespace.
* @param name A name for the logger. This should be a dot-separated name and should normally be based on the package name or class name of the subsystem, such as goog.net.BrowserChannel.
*/
static getLogger (name : string ) : ಠ_ಠ.clutz.goog.debug.Logger ;
/**
* Logs a message to profiling tools, if available.
* {@see https://developers.google.com/web-toolkit/speedtracer/logging-api}
* {@see http://msdn.microsoft.com/en-us/library/dd433074(VS.85).aspx}
* @param msg The message to log.
*/
static logToProfilers (msg : string ) : void ;
}
class Logger_Instance {
private noStructuralTyping_: any;
/**
* The Logger is an object used for logging debug messages. Loggers are
* normally named, using a hierarchical dot-separated namespace. Logger names
* can be arbitrary strings, but they should normally be based on the package
* name or class name of the logged component, such as goog.net.BrowserChannel.
*
* The Logger object is loosely based on the java class
* java.util.logging.Logger. It supports different levels of filtering for
* different loggers.
*
* The logger object should never be instantiated by application code. It
* should always use the goog.debug.Logger.getLogger function.
* @param name The name of the Logger.
*/
constructor (name : string ) ;
/**
* Adds a handler to the logger. This doesn't use the event system because
* we want to be able to add logging to the event system.
* @param handler Handler function to add.
*/
addHandler (handler : Function | null ) : void ;
/**
* Logs a message at the Logger.Level.CONFIG level.
* If the logger is currently enabled for the given message level then the
* given message is forwarded to all the registered output Handler objects.
* @param msg The message to log.
* @param opt_exception An exception associated with the message.
*/
config (msg : string | ( ( ) => string ) , opt_exception ? : GlobalError | null ) : void ;
/**
* Logs a message at the Logger.Level.FINE level.
* If the logger is currently enabled for the given message level then the
* given message is forwarded to all the registered output Handler objects.
* @param msg The message to log.
* @param opt_exception An exception associated with the message.
*/
fine (msg : string | ( ( ) => string ) , opt_exception ? : GlobalError | null ) : void ;
/**
* Logs a message at the Logger.Level.FINER level.
* If the logger is currently enabled for the given message level then the
* given message is forwarded to all the registered output Handler objects.
* @param msg The message to log.
* @param opt_exception An exception associated with the message.
*/
finer (msg : string | ( ( ) => string ) , opt_exception ? : GlobalError | null ) : void ;
/**
* Logs a message at the Logger.Level.FINEST level.
* If the logger is currently enabled for the given message level then the
* given message is forwarded to all the registered output Handler objects.
* @param msg The message to log.
* @param opt_exception An exception associated with the message.
*/
finest (msg : string | ( ( ) => string ) , opt_exception ? : GlobalError | null ) : void ;
/**
* Returns the children of this logger as a map of the child name to the logger.
*/
getChildren ( ) : GlobalObject ;
/**
* Returns the effective level of the logger based on its ancestors' levels.
*/
getEffectiveLevel ( ) : ಠ_ಠ.clutz.goog.debug.Logger.Level | null ;
/**
* Gets the log level specifying which message levels will be logged by this
* logger. Message levels lower than this value will be discarded.
* The level value Level.OFF can be used to turn off logging. If the level
* is null, it means that this node should inherit its level from its nearest
* ancestor with a specific (non-null) level value.
*/
getLevel ( ) : ಠ_ಠ.clutz.goog.debug.Logger.Level | null ;
/**
* Creates a new log record and adds the exception (if present) to it.
* @param level One of the level identifiers.
* @param msg The string message.
* @param opt_exception An exception associated with the message.
*/
getLogRecord (level : ಠ_ಠ.clutz.goog.debug.Logger.Level | null , msg : string , opt_exception ? : null | GlobalObject ) : ಠ_ಠ.clutz.goog.debug.LogRecord ;
/**
* Gets the name of this logger.
*/
getName ( ) : string ;
/**
* Returns the parent of this logger.
*/
getParent ( ) : ಠ_ಠ.clutz.goog.debug.Logger | null ;
/**
* Logs a message at the Logger.Level.INFO level.
* If the logger is currently enabled for the given message level then the
* given message is forwarded to all the registered output Handler objects.
* @param msg The message to log.
* @param opt_exception An exception associated with the message.
*/
info (msg : string | ( ( ) => string ) , opt_exception ? : GlobalError | null ) : void ;
/**
* Checks if a message of the given level would actually be logged by this
* logger. This check is based on the Loggers effective level, which may be
* inherited from its parent.
* @param level The level to check.
*/
isLoggable (level : ಠ_ಠ.clutz.goog.debug.Logger.Level | null ) : boolean ;
/**
* Logs a message. If the logger is currently enabled for the
* given message level then the given message is forwarded to all the
* registered output Handler objects.
* @param level One of the level identifiers.
* @param msg The message to log.
* @param opt_exception An exception associated with the message.
*/
log (level : ಠ_ಠ.clutz.goog.debug.Logger.Level | null , msg : string | ( ( ) => string ) , opt_exception ? : null | GlobalObject ) : void ;
/**
* Logs a LogRecord. If the logger is currently enabled for the
* given message level then the given message is forwarded to all the
* registered output Handler objects.
* @param logRecord A log record to log.
*/
logRecord (logRecord : ಠ_ಠ.clutz.goog.debug.LogRecord | null ) : void ;
/**
* Removes a handler from the logger. This doesn't use the event system because
* we want to be able to add logging to the event system.
* @param handler Handler function to remove.
*/
removeHandler (handler : Function | null ) : boolean ;
/**
* Set the log level specifying which message levels will be logged by this
* logger. Message levels lower than this value will be discarded.
* The level value Level.OFF can be used to turn off logging. If the new level
* is null, it means that this node should inherit its level from its nearest
* ancestor with a specific (non-null) level value.
* @param level The new level.
*/
setLevel (level : ಠ_ಠ.clutz.goog.debug.Logger.Level | null ) : void ;
/**
* Logs a message at the Logger.Level.SEVERE level.
* If the logger is currently enabled for the given message level then the
* given message is forwarded to all the registered output Handler objects.
* @param msg The message to log.
* @param opt_exception An exception associated with the message.
*/
severe (msg : string | ( ( ) => string ) , opt_exception ? : GlobalError | null ) : void ;
/**
* Logs a message at the Logger.Level.SHOUT level.
* If the logger is currently enabled for the given message level then the
* given message is forwarded to all the registered output Handler objects.
* @param msg The message to log.
* @param opt_exception An exception associated with the message.
*/
shout (msg : string | ( ( ) => string ) , opt_exception ? : GlobalError | null ) : void ;
/**
* Logs a message at the Logger.Level.WARNING level.
* If the logger is currently enabled for the given message level then the
* given message is forwarded to all the registered output Handler objects.
* @param msg The message to log.
* @param opt_exception An exception associated with the message.
*/
warning (msg : string | ( ( ) => string ) , opt_exception ? : GlobalError | null ) : void ;
}
}
declare module 'goog:goog.debug.Logger' {
import alias = ಠ_ಠ.clutz.goog.debug.Logger;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.debug.Logger {
/**
* The Level class defines a set of standard logging levels that
* can be used to control logging output. The logging Level objects
* are ordered and are specified by ordered integers. Enabling logging
* at a given level also enables logging at all higher levels.
* <p>
* Clients should normally use the predefined Level constants such
* as Level.SEVERE.
* <p>
* The levels in descending order are:
* <ul>
* <li>SEVERE (highest value)
* <li>WARNING
* <li>INFO
* <li>CONFIG
* <li>FINE
* <li>FINER
* <li>FINEST (lowest value)
* </ul>
* In addition there is a level OFF that can be used to turn
* off logging, and a level ALL that can be used to enable
* logging of all messages.
*/
class Level extends Level_Instance {
/**
* ALL indicates that all messages should be logged.
* This level is initialized to <CODE>0</CODE>.
*/
static ALL : ಠ_ಠ.clutz.goog.debug.Logger.Level ;
/**
* CONFIG is a message level for static configuration messages.
* This level is initialized to <CODE>700</CODE>.
*/
static CONFIG : ಠ_ಠ.clutz.goog.debug.Logger.Level ;
/**
* FINE is a message level providing tracing information.
* This level is initialized to <CODE>500</CODE>.
*/
static FINE : ಠ_ಠ.clutz.goog.debug.Logger.Level ;
/**
* FINER indicates a fairly detailed tracing message.
* This level is initialized to <CODE>400</CODE>.
*/
static FINER : ಠ_ಠ.clutz.goog.debug.Logger.Level ;
/**
* FINEST indicates a highly detailed tracing message.
* This level is initialized to <CODE>300</CODE>.
*/
static FINEST : ಠ_ಠ.clutz.goog.debug.Logger.Level ;
/**
* INFO is a message level for informational messages.
* This level is initialized to <CODE>800</CODE>.
*/
static INFO : ಠ_ಠ.clutz.goog.debug.Logger.Level ;
/**
* OFF is a special level that can be used to turn off logging.
* This level is initialized to <CODE>Infinity</CODE>.
*/
static OFF : ಠ_ಠ.clutz.goog.debug.Logger.Level ;
/**
* The predefined levels.
*/
static PREDEFINED_LEVELS : ಠ_ಠ.clutz.goog.debug.Logger.Level [] ;
/**
* SEVERE is a message level indicating a serious failure.
* This level is initialized to <CODE>1000</CODE>.
*/
static SEVERE : ಠ_ಠ.clutz.goog.debug.Logger.Level ;
/**
* SHOUT is a message level for extra debugging loudness.
* This level is initialized to <CODE>1200</CODE>.
*/
static SHOUT : ಠ_ಠ.clutz.goog.debug.Logger.Level ;
/**
* WARNING is a message level indicating a potential problem.
* This level is initialized to <CODE>900</CODE>.
*/
static WARNING : ಠ_ಠ.clutz.goog.debug.Logger.Level ;
/**
* Gets the predefined level with the given name.
* @param name The name of the level.
*/
static getPredefinedLevel (name : string ) : ಠ_ಠ.clutz.goog.debug.Logger.Level | null ;
/**
* Gets the highest predefined level <= #value.
* @param value Level value.
*/
static getPredefinedLevelByValue (value : number ) : ಠ_ಠ.clutz.goog.debug.Logger.Level | null ;
}
class Level_Instance {
private noStructuralTyping_: any;
/**
* The Level class defines a set of standard logging levels that
* can be used to control logging output. The logging Level objects
* are ordered and are specified by ordered integers. Enabling logging
* at a given level also enables logging at all higher levels.
* <p>
* Clients should normally use the predefined Level constants such
* as Level.SEVERE.
* <p>
* The levels in descending order are:
* <ul>
* <li>SEVERE (highest value)
* <li>WARNING
* <li>INFO
* <li>CONFIG
* <li>FINE
* <li>FINER
* <li>FINEST (lowest value)
* </ul>
* In addition there is a level OFF that can be used to turn
* off logging, and a level ALL that can be used to enable
* logging of all messages.
* @param name The name of the level.
* @param value The numeric value of the level.
*/
constructor (name : string , value : number ) ;
/**
* The name of the level
*/
name : string ;
/**
* The numeric value of the level
*/
value : number ;
toString ( ) : string ;
}
}
declare module 'goog:goog.debug.Logger.Level' {
import alias = ಠ_ಠ.clutz.goog.debug.Logger.Level;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.debug.entryPointRegistry {
/**
* Configures a monitor to wrap all entry points.
*
* Entry points that have already been registered are immediately wrapped by
* the monitor. When an entry point is registered in the future, it will also
* be wrapped by the monitor when it is registered.
* @param monitor An entry point monitor.
*/
function monitorAll (monitor : ಠ_ಠ.clutz.goog.debug.EntryPointMonitor ) : void ;
/**
* Register an entry point with this module.
*
* The entry point will be instrumented when a monitor is passed to
* goog.debug.entryPointRegistry.monitorAll. If this has already occurred, the
* entry point is instrumented immediately.
* @param callback A callback function which is called with a transforming function to instrument the entry point. The callback is responsible for wrapping the relevant entry point with the transforming function.
*/
function register (callback : (a : Function ) => any ) : void ;
/**
* Try to unmonitor all the entry points that have already been registered. If
* an entry point is registered in the future, it will not be wrapped by the
* monitor when it is registered. Note that this may fail if the entry points
* have additional wrapping.
* @param monitor The last monitor to wrap the entry points.
*/
function unmonitorAllIfPossible (monitor : ಠ_ಠ.clutz.goog.debug.EntryPointMonitor ) : void ;
}
declare module 'goog:goog.debug.entryPointRegistry' {
import alias = ಠ_ಠ.clutz.goog.debug.entryPointRegistry;
export = alias;
}
declare namespace ಠ_ಠ.clutz.goog.debug.errorcontext {
/**
* Adds key-value context to the error.
* @param err The error to add context to.
* @param contextKey Key for the context to be added.
* @param contextValue Value for the context to be added.
*/
function addErrorContext (err : GlobalError , contextKey : string , contextValue : string ) : void ;
function getErrorContext (err : GlobalError ) : { [ key: string ]: string } ;
}
declare module 'goog:goog.debug.errorcontext' {
import alias = ಠ_ಠ.clutz.goog.debug.errorcontext;
export = alias;
}
declare namespace ಠ_ಠ.clutz.goog.disposable {
/**
* Interface for a disposable object. If a instance requires cleanup
* (references COM objects, DOM nodes, or other disposable objects), it should
* implement this interface (it may subclass goog.Disposable).
*/
interface IDisposable {
/**
* Disposes of the object and its resources.
*/
dispose ( ) : void ;
isDisposed ( ) : boolean ;
}
}
declare module 'goog:goog.disposable.IDisposable' {
import alias = ಠ_ಠ.clutz.goog.disposable.IDisposable;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog {
/**
* Calls {@code dispose} on the argument if it supports it. If obj is not an
* object with a dispose() method, this is a no-op.
* @param obj The object to dispose of.
*/
function dispose (obj : any ) : void ;
}
declare module 'goog:goog.dispose' {
import alias = ಠ_ಠ.clutz.goog.dispose;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog {
/**
* Calls {@code dispose} on each member of the list that supports it. (If the
* member is an ArrayLike, then {@code goog.disposeAll()} will be called
* recursively on each of its members.) If the member is not an object with a
* {@code dispose()} method, then it is ignored.
* @param var_args The list.
*/
function disposeAll ( ...var_args : any [] ) : void ;
}
declare module 'goog:goog.disposeAll' {
import alias = ಠ_ಠ.clutz.goog.disposeAll;
export default alias;
}
declare namespace ಠ_ಠ.clutz.goog.dom {
/**
* Alias for getElement.
* @param element Element ID or a DOM node.
*/
function $ (a : string | Element | null ) : Element | null ;
/**
* Alias for {@code getElementsByTagNameAndClass}.
* @param opt_tag Element tag name.
* @param opt_class Optional class name.
* @param opt_el Optional element to look in.
*/
function $$ < T , R > (a ? : string | ಠ_ಠ.clutz.goog.dom.TagName < T > | null , b ? : string | null , c ? : Element | null ) : ArrayLike < R > ;
/**
* Alias for {@code createDom}.
* @param tagName Tag to create.
* @param opt_attributes If object, then a map of name-value pairs for attributes. If a string, then this is the className of the new element. If an array, the elements will be joined together as the className of the new element.
* @param var_args Further DOM nodes or strings for text nodes. If one of the var_args is an array, its children will be added as childNodes instead.
*/
function $dom < T , R > (a : string | ಠ_ಠ.clutz.goog.dom.TagName < T > , b ? : GlobalObject | null | string , ...c : ( GlobalObject | null | string | undefined ) [] ) : R ;
var ASSUME_QUIRKS_MODE : boolean ;
var ASSUME_STANDARDS_MODE : boolean ;
/**
* Appends a node with text or other nodes.
* @param parent The node to append nodes to.
* @param var_args The things to append to the node. If this is a Node it is appended as is. If this is a string then a text node is appended. If this is an array like object then fields 0 to length - 1 are appended.
*/
function append (parent : Node , ...var_args : ( GlobalObject | null | string | undefined ) [] ) : void ;
/**
* Appends a child to a node.
* @param parent Parent.
* @param child Child.
*/
function appendChild (parent : Node | null , child : Node | null ) : void ;
/**
* Determines if the given node can contain children, intended to be used for
* HTML generation.
*
* IE natively supports node.canHaveChildren but has inconsistent behavior.
* Prior to IE8 the base tag allows children and in IE9 all nodes return true
* for canHaveChildren.
*
* In practice all non-IE browsers allow you to add children to any node, but
* the behavior is inconsistent:
*
* <pre>
* var a = goog.dom.createElement(goog.dom.TagName.BR);
* a.appendChild(document.createTextNode('foo'));
* a.appendChild(document.createTextNode('bar'));
* console.log(a.childNodes.length); // 2
* console.log(a.innerHTML); // Chrome: "", IE9: "foobar", FF3.5: "foobar"
* </pre>
*
* For more information, see:
* http://dev.w3.org/html5/markup/syntax.html#syntax-elements
*
* TODO(user): Rename shouldAllowChildren() ?
* @param node The node to check.
*/
function canHaveChildren (node : Node | null ) : boolean ;
/**
* Compares the document order of two nodes, returning 0 if they are the same
* node, a negative number if node1 is before node2, and a positive number if
* node2 is before node1. Note that we compare the order the tags appear in the
* document so in the tree <b><i>text</i></b> the B node is considered to be
* before the I node.
* @param node1 The first node to compare.
* @param node2 The second node to compare.
*/
function compareNodeOrder (node1 : Node | null , node2 : Node | null ) : number ;
/**
* Creates a new Node from constant strings of HTML markup.
* @param var_args The HTML strings to concatenate then convert into a node.
*/
function constHtmlToNode ( ...var_args : ( ಠ_ಠ.clutz.goog.string.Const | undefined ) [] ) : Node ;
/**
* Whether a node contains another node.
* @param parent The node that should contain the other node.
* @param descendant The node to test presence of.
*/
function contains (parent : Node | null | undefined , descendant : Node | null | undefined ) : boolean ;
/**
* Returns a dom node with a set of attributes. This function accepts varargs
* for subsequent nodes to be added. Subsequent nodes will be added to the
* first node as childNodes.
*
* So:
* <code>createDom(goog.dom.TagName.DIV, null, createDom(goog.dom.TagName.P),
* createDom(goog.dom.TagName.P));</code> would return a div with two child
* paragraphs
*
* For passing properties, please see {@link goog.dom.setProperties} for more
* information.
* @param tagName Tag to create.
* @param opt_attributes If object, then a map of name-value pairs for attributes. If a string, then this is the className of the new element. If an array, the elements will be joined together as the className of the new element.
* @param var_args Further DOM nodes or strings for text nodes. If one of the var_args is an array or NodeList, its elements will be added as childNodes instead.
*/
function createDom < T , R > (tagName : string | ಠ_ಠ.clutz.goog.dom.TagName < T > , opt_attributes ? : GlobalObject | null | string , ...var_args : ( GlobalObject | null | string | undefined ) [] ) : R ;
/**
* Creates a new element.
* @param name Tag to create.
*/
function createElement < T , R > (name : string | ಠ_ಠ.clutz.goog.dom.TagName < T > ) : R ;
/**
* Create a table.
* @param rows The number of rows in the table. Must be >= 1.
* @param columns The number of columns in the table. Must be >= 1.
* @param opt_fillWithNbsp If true, fills table entries with {@code goog.string.Unicode.NBSP} characters.
*/
function createTable (rows : number , columns : number , opt_fillWithNbsp ? : boolean ) : Element ;
/**
* Creates a new text node.
* @param content Content.
*/
function