WebChannelTransport
to
9 | * avoid exposing concrete classes to clients.
10 | */
11 |
12 | goog.provide('goog.net.createWebChannelTransport');
13 |
14 | goog.require('goog.labs.net.webChannel.WebChannelBaseTransport');
15 | goog.requireType('goog.net.WebChannelTransport');
16 |
17 |
18 | /**
19 | * Create a new WebChannelTransport instance using the default implementation.
20 | * Throws an error message if no default transport available in the current
21 | * environment.
22 | *
23 | * @return {!goog.net.WebChannelTransport} the newly created transport instance.
24 | */
25 | goog.net.createWebChannelTransport = function() {
26 | 'use strict';
27 | return new goog.labs.net.webChannel.WebChannelBaseTransport();
28 | };
29 |
--------------------------------------------------------------------------------
/docs/closure/goog/labs/testing/assertthat.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright The Closure Library Authors.
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | /**
8 | * @fileoverview Provides main functionality of assertThat. assertThat calls the
9 | * matcher's matches method to test if a matcher matches assertThat's arguments.
10 | */
11 |
12 | goog.module('goog.labs.testing.assertThat');
13 | goog.module.declareLegacyNamespace();
14 |
15 | const Matcher = goog.requireType('goog.labs.testing.Matcher');
16 | const MatcherError = goog.require('goog.labs.testing.MatcherError');
17 |
18 | /**
19 | * Asserts that the actual value evaluated by the matcher is true.
20 | *
21 | * @param {*} actual The object to assert by the matcher.
22 | * @param {!Matcher} matcher A matcher to verify values.
23 | * @param {string=} opt_reason Description of what is asserted.
24 | */
25 | function assertThat(actual, matcher, opt_reason) {
26 | if (!matcher.matches(actual)) {
27 | // Prefix the error description with a reason from the assert
28 | const prefix = opt_reason ? opt_reason + ': ' : '';
29 | const desc = prefix + matcher.describe(actual);
30 |
31 | // some sort of failure here
32 | throw new MatcherError(desc);
33 | }
34 | }
35 |
36 | exports = assertThat;
37 |
--------------------------------------------------------------------------------
/docs/closure/goog/labs/testing/matchererror.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright The Closure Library Authors.
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | /**
8 | * @fileoverview Provides main functionality of assertThat. assertThat calls the
9 | * matcher's matches method to test if a matcher matches assertThat's arguments.
10 | */
11 |
12 | goog.module('goog.labs.testing.MatcherError');
13 | goog.module.declareLegacyNamespace();
14 |
15 | const DebugError = goog.require('goog.debug.Error');
16 |
17 | /**
18 | * Error thrown when a Matcher fails to match the input value.
19 | * @param {string=} message The error message.
20 | * @constructor
21 | * @extends {DebugError}
22 | * @final
23 | */
24 | function MatcherError(message) {
25 | MatcherError.base(this, 'constructor', message);
26 | }
27 | goog.inherits(MatcherError, DebugError);
28 |
29 | exports = MatcherError;
30 |
--------------------------------------------------------------------------------
/docs/closure/goog/labs/useragent/extra.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright The Closure Library Authors.
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | /**
8 | * @fileoverview Provides extra checks for user agent that are not reflected in
9 | * the standard user agent checks. This includes runtime heuristics to determine
10 | * the true environment on browsers that present a different user agent to
11 | * appear to be running in a different environment.
12 | */
13 |
14 | goog.module('goog.labs.userAgent.extra');
15 |
16 | const platform = goog.require('goog.labs.userAgent.platform');
17 |
18 | /**
19 | * Checks whether the browser appears to be a desktop-class running on a mobile
20 | * device. Starting with iPadOS 13 this is the default for non-mini iPads
21 | * running at >=2/3 of the screen. The user agent is otherwise indistinguishable
22 | * from Mac Safari. The user can also force desktop on other devices. This logic
23 | * previously also checked for Safari, however other iOS browsers have since
24 | * adopted the same behavior.
25 | *
26 | * @return {boolean} Whether the runtime heuristics thinks this is Desktop
27 | * Safari on a non-desktop device.
28 | */
29 | function isSafariDesktopOnMobile() {
30 | return platform.isMacintosh() && goog.global.navigator.maxTouchPoints > 0;
31 | }
32 |
33 | exports = {isSafariDesktopOnMobile};
34 |
--------------------------------------------------------------------------------
/docs/closure/goog/math/irect.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright The Closure Library Authors.
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | /**
8 | * @fileoverview A record declaration to allow ClientRect and other rectangle
9 | * like objects to be used with goog.math.Rect.
10 | */
11 |
12 | goog.provide('goog.math.IRect');
13 |
14 |
15 | /**
16 | * Record for representing rectangular regions, allows compatibility between
17 | * things like ClientRect and goog.math.Rect.
18 | *
19 | * @record
20 | */
21 | goog.math.IRect = function() {};
22 |
23 |
24 | /** @type {number} */
25 | goog.math.IRect.prototype.left;
26 |
27 |
28 | /** @type {number} */
29 | goog.math.IRect.prototype.top;
30 |
31 |
32 | /** @type {number} */
33 | goog.math.IRect.prototype.width;
34 |
35 |
36 | /** @type {number} */
37 | goog.math.IRect.prototype.height;
38 |
--------------------------------------------------------------------------------
/docs/closure/goog/messaging/messaging.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright The Closure Library Authors.
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | /**
8 | * @fileoverview Functions for manipulating message channels.
9 | */
10 |
11 | goog.provide('goog.messaging');
12 |
13 | goog.requireType('goog.messaging.MessageChannel');
14 |
15 |
16 | /**
17 | * Creates a bidirectional pipe between two message channels.
18 | *
19 | * @param {goog.messaging.MessageChannel} channel1 The first channel.
20 | * @param {goog.messaging.MessageChannel} channel2 The second channel.
21 | */
22 | goog.messaging.pipe = function(channel1, channel2) {
23 | 'use strict';
24 | channel1.registerDefaultService(goog.bind(channel2.send, channel2));
25 | channel2.registerDefaultService(goog.bind(channel1.send, channel1));
26 | };
27 |
--------------------------------------------------------------------------------
/docs/closure/goog/module/basemodule.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright The Closure Library Authors.
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | /**
8 | * @fileoverview Defines the base class for a module. This is used to allow the
9 | * code to be modularized, giving the benefits of lazy loading and loading on
10 | * demand.
11 | */
12 |
13 | goog.provide('goog.module.BaseModule');
14 |
15 | goog.require('goog.Disposable');
16 | /** @suppress {extraRequire} */
17 | goog.require('goog.module');
18 |
19 |
20 |
21 | /**
22 | * A basic module object that represents a module of JavaScript code that can
23 | * be dynamically loaded.
24 | *
25 | * @constructor
26 | * @extends {goog.Disposable}
27 | */
28 | goog.module.BaseModule = function() {
29 | 'use strict';
30 | goog.Disposable.call(this);
31 | };
32 | goog.inherits(goog.module.BaseModule, goog.Disposable);
33 |
34 |
35 | /**
36 | * Performs any load-time initialization that the module requires.
37 | * @param {Object} context The module context.
38 | */
39 | goog.module.BaseModule.prototype.initialize = function(context) {};
40 |
--------------------------------------------------------------------------------
/docs/closure/goog/module/module.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright The Closure Library Authors.
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | /**
8 | *
9 | * @fileoverview This class supports the dynamic loading of compiled
10 | * javascript modules at runtime, as described in the designdoc.
11 | *
12 | *
17 | * /** @type {!goog.pubsub.TopicId}
18 | * zorg.TopicId.STATE_CHANGE = new goog.pubsub.TopicId(
19 | * goog.events.getUniqueId('state-change'));
20 | *
21 | * // Compiler enforces that these types are correct.
22 | * pubSub.publish(zorg.TopicId.STATE_CHANGE, zorg.State.STARTED);
23 | *
24 | *
25 | * Typical usage for a subscriber:
26 | *
27 | * // Compiler enforces the callback parameter type.
28 | * pubSub.subscribe(zorg.TopicId.STATE_CHANGE, function(state) {
29 | * if (state == zorg.State.STARTED) {
30 | * // Handle STARTED state.
31 | * }
32 | * });
33 | *
34 | *
35 | * @param {string} topicId
36 | * @template PAYLOAD
37 | * @constructor
38 | * @final
39 | * @struct
40 | */
41 | goog.pubsub.TopicId = function(topicId) {
42 | 'use strict';
43 | /**
44 | * @const
45 | * @private
46 | */
47 | this.topicId_ = topicId;
48 | };
49 |
50 |
51 | /** @override */
52 | goog.pubsub.TopicId.prototype.toString = function() {
53 | 'use strict';
54 | return this.topicId_;
55 | };
56 |
--------------------------------------------------------------------------------
/docs/closure/goog/soy/injecteddatasupplier.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright The Closure Library Authors.
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | /**
8 | * @fileoverview Provides an interface {@link goog.soy.InjectedDataSupplier}
9 | * that users should implement to provide the injected data for a specific
10 | * application via goog.soy.renderer. The injected data format is a JavaScript
11 | * object:
12 | *
13 | * 14 | * {'dataKey': 'value', 'otherDataKey': 'otherValue'} 15 | *16 | * 17 | * The injected data can then be referred to in any soy templates as 18 | * part of a magic "ij" parameter. For example, `$ij.dataKey` 19 | * will evaluate to 'value' with the above injected data. 20 | */ 21 | 22 | goog.module('goog.soy.InjectedDataSupplier'); 23 | goog.module.declareLegacyNamespace(); 24 | 25 | /** 26 | * An interface for a supplier that provides Soy injected data. 27 | * @interface 28 | */ 29 | exports = class InjectedDataSupplier { 30 | /** 31 | * Gets the injected data. Implementation may assume that 32 | * `goog.soy.Renderer` will treat the returned data as 33 | * immutable. The renderer will call this every time one of its 34 | * `render*` methods is called. 35 | * @return {?} A key-value pair representing the injected data. 36 | */ 37 | getData() {} 38 | }; 39 | -------------------------------------------------------------------------------- /docs/closure/goog/storage/errorcode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright The Closure Library Authors. 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | /** 8 | * @fileoverview Defines errors to be thrown by the storage. 9 | */ 10 | 11 | goog.provide('goog.storage.ErrorCode'); 12 | 13 | 14 | /** 15 | * Errors thrown by the storage. 16 | * @enum {string} 17 | */ 18 | goog.storage.ErrorCode = { 19 | INVALID_VALUE: 'Storage: Invalid value was encountered', 20 | DECRYPTION_ERROR: 'Storage: The value could not be decrypted' 21 | }; 22 | -------------------------------------------------------------------------------- /docs/closure/goog/storage/mechanism/errorcode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright The Closure Library Authors. 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | /** 8 | * @fileoverview Defines error codes to be thrown by storage mechanisms. 9 | */ 10 | 11 | goog.provide('goog.storage.mechanism.ErrorCode'); 12 | 13 | 14 | /** 15 | * Errors thrown by storage mechanisms. 16 | * @enum {string} 17 | */ 18 | goog.storage.mechanism.ErrorCode = { 19 | INVALID_VALUE: 'Storage mechanism: Invalid value was encountered', 20 | QUOTA_EXCEEDED: 'Storage mechanism: Quota exceeded', 21 | STORAGE_DISABLED: 'Storage mechanism: Storage disabled' 22 | }; 23 | -------------------------------------------------------------------------------- /docs/closure/goog/storage/mechanism/html5localstorage.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright The Closure Library Authors. 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | /** 8 | * @fileoverview Provides data persistence using HTML5 local storage 9 | * mechanism. Local storage must be available under window.localStorage, 10 | * see: http://www.w3.org/TR/webstorage/#the-localstorage-attribute. 11 | */ 12 | 13 | goog.provide('goog.storage.mechanism.HTML5LocalStorage'); 14 | 15 | goog.require('goog.storage.mechanism.HTML5WebStorage'); 16 | 17 | 18 | 19 | /** 20 | * Provides a storage mechanism that uses HTML5 local storage. 21 | * 22 | * @constructor 23 | * @struct 24 | * @extends {goog.storage.mechanism.HTML5WebStorage} 25 | */ 26 | goog.storage.mechanism.HTML5LocalStorage = function() { 27 | 'use strict'; 28 | var storage = null; 29 | 30 | try { 31 | // May throw an exception in cases where the local storage object 32 | // is visible but access to it is disabled. 33 | storage = window.localStorage || null; 34 | } catch (e) { 35 | } 36 | goog.storage.mechanism.HTML5LocalStorage.base(this, 'constructor', storage); 37 | }; 38 | goog.inherits( 39 | goog.storage.mechanism.HTML5LocalStorage, 40 | goog.storage.mechanism.HTML5WebStorage); 41 | -------------------------------------------------------------------------------- /docs/closure/goog/storage/mechanism/html5sessionstorage.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright The Closure Library Authors. 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | /** 8 | * @fileoverview Provides data persistence using HTML5 session storage 9 | * mechanism. Session storage must be available under window.sessionStorage, 10 | * see: http://www.w3.org/TR/webstorage/#the-sessionstorage-attribute. 11 | */ 12 | 13 | goog.provide('goog.storage.mechanism.HTML5SessionStorage'); 14 | 15 | goog.require('goog.storage.mechanism.HTML5WebStorage'); 16 | 17 | 18 | 19 | /** 20 | * Provides a storage mechanism that uses HTML5 session storage. 21 | * 22 | * @constructor 23 | * @struct 24 | * @extends {goog.storage.mechanism.HTML5WebStorage} 25 | */ 26 | goog.storage.mechanism.HTML5SessionStorage = function() { 27 | 'use strict'; 28 | var storage = null; 29 | 30 | try { 31 | // May throw an exception in cases where the session storage object is 32 | // visible but access to it is disabled. For example, accessing the file 33 | // in local mode in Firefox throws 'Operation is not supported' exception. 34 | storage = window.sessionStorage || null; 35 | } catch (e) { 36 | } 37 | goog.storage.mechanism.HTML5SessionStorage.base(this, 'constructor', storage); 38 | }; 39 | goog.inherits( 40 | goog.storage.mechanism.HTML5SessionStorage, 41 | goog.storage.mechanism.HTML5WebStorage); 42 | -------------------------------------------------------------------------------- /docs/closure/goog/storage/mechanism/mechanism.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright The Closure Library Authors. 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | /** 8 | * @fileoverview Abstract interface for storing and retrieving data using 9 | * some persistence mechanism. 10 | */ 11 | 12 | goog.provide('goog.storage.mechanism.Mechanism'); 13 | 14 | 15 | 16 | /** 17 | * Basic interface for all storage mechanisms. 18 | * 19 | * @constructor 20 | * @struct 21 | * @abstract 22 | */ 23 | goog.storage.mechanism.Mechanism = function() {}; 24 | 25 | 26 | /** 27 | * Set a value for a key. 28 | * 29 | * @param {string} key The key to set. 30 | * @param {string} value The string to save. 31 | * @abstract 32 | */ 33 | goog.storage.mechanism.Mechanism.prototype.set = function(key, value) {}; 34 | 35 | 36 | /** 37 | * Get the value stored under a key. 38 | * 39 | * @param {string} key The key to get. 40 | * @return {?string} The corresponding value, null if not found. 41 | * @abstract 42 | */ 43 | goog.storage.mechanism.Mechanism.prototype.get = function(key) {}; 44 | 45 | 46 | /** 47 | * Remove a key and its value. 48 | * 49 | * @param {string} key The key to remove. 50 | * @abstract 51 | */ 52 | goog.storage.mechanism.Mechanism.prototype.remove = function(key) {}; 53 | -------------------------------------------------------------------------------- /docs/closure/goog/storage/mechanism/mechanismtestdefinition.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright The Closure Library Authors. 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | 8 | /** 9 | * @fileoverview This shim namespace defines the shared 10 | * mechanism variables used in mechanismSeparationTester 11 | * and mechanismSelectionTester. This exists to allow test compilation 12 | * to work correctly for these legacy tests. 13 | */ 14 | 15 | goog.provide('goog.storage.mechanism.mechanismTestDefinition'); 16 | goog.setTestOnly('goog.storage.mechanism.mechanismTestDefinition'); 17 | 18 | var mechanism; 19 | var mechanism_shared; 20 | var mechanism_separate; 21 | var minimumQuota; 22 | -------------------------------------------------------------------------------- /docs/closure/goog/streams/defines.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright The Closure Library Authors. 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | /** 8 | * @fileoverview Defines used by streams. 9 | */ 10 | goog.module('goog.streams.defines'); 11 | 12 | /** 13 | * 'false', 'true', or 'detect'. Detect does runtime feature detection. 14 | * @define {string} 15 | */ 16 | const USE_NATIVE_IMPLEMENTATION = 17 | goog.define('goog.streams.USE_NATIVE_IMPLEMENTATION', 'false'); 18 | 19 | exports = { 20 | USE_NATIVE_IMPLEMENTATION, 21 | }; 22 | -------------------------------------------------------------------------------- /docs/closure/goog/streams/lite.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license 3 | * Copyright The Closure Library Authors. 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | /** 8 | * @fileoverview A lite polyfill of the ReadableStream native API with a subset 9 | * of methods supported. 10 | */ 11 | goog.module('goog.streams.lite'); 12 | 13 | const liteImpl = goog.require('goog.streams.liteImpl'); 14 | const liteNativeImpl = goog.require('goog.streams.liteNativeImpl'); 15 | const {ReadableStream, ReadableStreamDefaultController, ReadableStreamDefaultReader, ReadableStreamUnderlyingSource} = goog.require('goog.streams.liteTypes'); 16 | const {USE_NATIVE_IMPLEMENTATION} = goog.require('goog.streams.defines'); 17 | 18 | /** 19 | * Creates and returns a new ReadableStream. 20 | * 21 | * The underlying source should only have a start() method, and no other 22 | * properties. 23 | * @param {!ReadableStreamUnderlyingSource