Lines Matching full:goog
134 <li><code>goog.module</code> statement</li>
135 <li><code>goog.require</code> statements</li>
150 <h3 id="file-goog-module">3.3 <code>goog.module</code> statement</h3>
152 <p>All files must declare exactly one <code>goog.module</code> name on a single line: lines
153 containing a <code>goog.module</code> declaration must not be wrapped, and are therefore an
156 <p>The entire argument to goog.module is what defines a namespace. It is the
163 <pre><code class="language-js prettyprint">goog.module('search.urlHistory.UrlHistoryService');
173 <pre><code class="language-js prettyprint badcode">goog.module('foo.bar'); // 'foo.bar.qux' would be fine, though
174 goog.module('foo.bar.baz');
182 <h4 id="file-set-test-only">3.3.2 <code>goog.setTestOnly</code></h4>
184 <p>The single <code>goog.module</code> statement may optionally be followed by a call to
185 goog.setTestOnly().</p>
187 <h4 id="file-declare-legacy-namespace">3.3.3 <code>goog.module.declareLegacyNamespace</code></h4>
189 <p>The single <code>goog.module</code> statement may optionally be followed by a call to
190 <code>goog.module.declareLegacyNamespace();</code>. Avoid
191 <code>goog.module.declareLegacyNamespace()</code> when possible.</p>
195 <pre><code class="language-js prettyprint">goog.module('my.test.helpers');
196 goog.module.declareLegacyNamespace();
197 goog.setTestOnly();
200 <p><code>goog.module.declareLegacyNamespace</code> exists to ease the transition from
204 <code>goog.module</code> (for example, <code>goog.module('parent');</code> and
205 <code>goog.module('parent.child');</code> cannot both exist safely, nor can
206 <code>goog.module('parent');</code> and <code>goog.module('parent.child.grandchild');</code>).</p>
214 <h3 id="file-goog-require">3.4 <code>goog.require</code> statements</h3>
216 <p>Imports are done with <code>goog.require</code> statements, grouped together immediately
217 following the module declaration. Each <code>goog.require</code> is assigned to a single
221 except as the argument to <code>goog.require</code>. Alias names should match the final
225 disambiguate, or if it significantly improves readability. <code>goog.require</code>
238 Finally, any <code>goog.require</code> calls that are standalone (generally these are for
246 it <strong>must not</strong> be wrapped: goog.require lines are an exception to the 80-column
251 <pre><code class="language-js prettyprint">const MyClass = goog.require('some.package.MyClass');
252 const NsMyClass = goog.require('other.ns.MyClass');
253 const googAsserts = goog.require('goog.asserts');
254 const testingAsserts = goog.require('goog.testing.asserts');
255 const than80columns = goog.require('pretend.this.is.longer.than80columns');
256 const {clear, forEach, map} = goog.require('goog.array');
258 goog.require('my.framework.initialization');
263 <pre><code class="language-js badcode prettyprint">const randomName = goog.require('something.else'); // name must match
266 goog.require('goog.array');
269 const alias = goog.require('my.long.name.alias'); // must be at top level
274 <h4 id="file-goog-forward-declare">3.4.1 <code>goog.forwardDeclare</code></h4>
276 <p><code>goog.forwardDeclare</code> is not needed very often, but is a valuable tool to break
278 grouped together and immediately follow any <code>goog.require</code> statements. A
279 <code>goog.forwardDeclare</code> statement must follow the same style rules as a
280 <code>goog.require</code> statement.</p>
562 <li><code>goog.module</code> and <code>goog.require</code> statements (see <a href="#file-goog-module">??</a> and
563 <a href="#file-goog-require">??</a>).</li>
654 <a href="#file-goog-require">??</a>).</li>
1061 <p>Destructuring may also be used for <code>goog.require</code> statements, and in this case
1063 long it is (see <a href="#file-goog-require">??</a>).</p>
1177 <p><code>goog.defineClass</code> allows for a class-like definition similar to ES6 class
1180 <pre><code class="language-javascript">let C = goog.defineClass(S, {
1200 <p>Alternatively, while <code>goog.defineClass</code> should be preferred for all new code,
1212 goog.inherits(C, S);
1225 <p>Defining constructor prototype hierarchies correctly is harder than it first appears! For that reason, it is best to use <code>goog.inherits</code> from <a href="http://code.google.com/closure/library/">the Closure Library </a>.</p>
1344 <code>goog.bind(f, this)</code>. Avoid writing <code>const self = this</code>. Arrow functions are
1783 const Foo = goog.require('my.Foo'); // mirrors imported name
1792 fully-qualified names. Follow the same rules as <code>goog.require</code>s
1793 (<a href="#file-goog-require">??</a>), maintaining the last part of the aliased name.
2452 * Throws {@code goog.iter.StopIteration} when it
2456 goog.dom.RangeIterator.prototype.next = function() {
2470 * @see goog.Collect
2471 * @see goog.RecklessAdder#add
2495 exports.MSG_ACCOUNT_CREATED = goog.getMsg(
2690 <h4 id="appendices-legacy-exceptions-goog-provide">9.4.4 Dependency management with <code>goog.provide</code>/<code>goog.require</code></h4>
2692 <p><strong><code>goog.provide</code> is deprecated. All new files should use <code>goog.module</code>, even in
2693 projects with existing <code>goog.provide</code> usage. The following rules are for
2694 pre-existing goog.provide files, only.</strong></p>
2696 <h5 id="appendices-legacy-exceptions-goog-provide-summary">9.4.4.1 Summary</h5>
2699 <li>Place all <code>goog.provide</code>s first, <code>goog.require</code>s second. Separate provides
2702 <li>Don't wrap <code>goog.provide</code> and <code>goog.require</code> statements. Exceed 80 columns
2707 <p>As of Oct 2016, <strong><code>goog.provide</code>/<code>goog.require</code> dependency management is
2708 deprecated</strong>. All new files, even in projects using <code>goog.provide</code> for older
2710 <a href="#source-file-structure"><code>goog.module</code></a>.</p>
2712 <p><code>goog.provide</code> statements should be grouped together and placed first. All
2713 <code>goog.require</code> statements should follow. The two lists should be separated with
2716 <p>Similar to import statements in other languages, <code>goog.provide</code> and
2717 <code>goog.require</code> statements should be written in a single line, even if they
2722 <pre><code class="language-js prettyprint">goog.provide('namespace.MyClass');
2723 goog.provide('namespace.helperFoo');
2725 goog.require('an.extremelyLongNamespace.thatSomeoneThought.wouldBeNice.andNowItIsLonger.Than80Columns');
2726 goog.require('goog.dom');
2727 goog.require('goog.dom.TagName');
2728 goog.require('goog.dom.classes');
2729 goog.require('goog.dominoes');
2739 <pre><code class="language-js prettyprint">goog.provide('namespace.MyClass');
2744 <pre><code class="language-js prettyprint badcode">goog.provide('namespace.MyClass');
2745 goog.provide('namespace.MyClass.CONSTANT');
2746 goog.provide('namespace.MyClass.Enum');
2747 goog.provide('namespace.MyClass.InnerClass');
2748 goog.provide('namespace.MyClass.TypeDef');
2749 goog.provide('namespace.MyClass.staticMethod');
2754 <pre><code class="language-js prettyprint">goog.provide('foo.bar');
2755 goog.provide('foo.bar.CONSTANT');
2756 goog.provide('foo.bar.method');
2759 <h5 id="appendices-legacy-exceptions-goog-scope">9.4.4.2 Aliasing with <code>goog.scope</code></h5>
2761 <p><strong><code>goog.scope</code> is deprecated. New files should not use <code>goog.scope</code> even in
2762 projects with existing goog.scope usage.</strong></p>
2764 <p><code>goog.scope</code> may be used to shorten references to namespaced symbols in
2765 code using <code>goog.provide</code>/<code>goog.require</code> dependency management.</p>
2767 <p>Only one <code>goog.scope</code> invocation may be added per file. Always place it in
2770 <p>The opening <code>goog.scope(function() {</code> invocation must be preceded by exactly one
2771 blank line and follow any <code>goog.provide</code> statements, <code>goog.require</code> statements,
2773 file. Append <code>// goog.scope</code> to the closing statement of the scope. Separate the
2776 <p>Similar to C++ namespaces, do not indent under <code>goog.scope</code> declarations.
2783 <pre><code class="language-js prettyprint badcode">goog.scope(function() {
2784 var Button = goog.ui.Button;
2792 <pre><code class="language-js prettyprint">goog.provide('my.module.SomeType');
2794 goog.require('goog.dom');
2795 goog.require('goog.ui.Button');
2797 goog.scope(function() {
2798 var Button = goog.ui.Button;
2799 var dom = goog.dom;
2811 }); // goog.scope