Google closure: goog.require could not find: goog.ui

I'm learning google closure, and when I try to use the goog.ui component (any class thereof), I get the error goog.require could not find: goog.ui.

My code is:

goog.require('goog.dom');
goog.require('goog.json');
goog.require('goog.events');
goog.require('goog.ui.HoverCard');
goog.require('goog.positioning.AnchoredPosition');
goog.require('goog.positioning.Corner');
goog.require('goog.ui.Component.EventType'); 
goog.require('goog.ui');

The other components (at least before I try to load any ui element) work just fine.

Any suggestions on what this could be? I have the version cloned from git about two days ago. I'm not compiling, because at this stage I just want to figure out how to write the code.

Answers


You can use goog.require() on elements that have been provided by a goog.provide() before.

goog.ui is never provided because it's not a component or something that you can use directly with "static" methods (Contrary to goog.events that has listen() methods for instance). It's just a naming convention to regroup all visual components.

However, you can do a goog.require('goog.ui.Component') or goog.require('goog.ui.Button') for instance.


I was able to eliminate this by:

  1. Loading the base.js file directly from google's git repository: http://closure-library.googlecode.com/git/closure/goog/base.js;

  2. Eliminating the attempt to require 'goog.ui' separately from any subcomponent thereof; and

  3. Moving the require calls into the HTML head directly (inside a script tag), rather than having them in a script loaded in the head.

This doesn't seem entirely satisfactory.


Need Your Help

store temp variables in neo4j

neo4j cypher graph-databases

I have some cypher queries that I execute against my neo4j database. The query is in this form

DST Causing +1 hour time difference in GCal Events

php google-calendar-api dst gcal

I've a php based application where I've integrated GCal with OAuth 2.0 API. Everything works fine except the DST +1 hour issue. This application is only for UK and I'm also storing the user account