admin管理员组文章数量:1417652
I'm learning google closure, and when I try to use the goog.ui
ponent (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 ponents (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 piling, because at this stage I just want to figure out how to write the code.
I'm learning google closure, and when I try to use the goog.ui
ponent (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 ponents (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 piling, because at this stage I just want to figure out how to write the code.
Share Improve this question asked Feb 1, 2014 at 18:23 MarcinMarcin 49.9k18 gold badges136 silver badges207 bronze badges2 Answers
Reset to default 4You 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 ponent 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 ponents.
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:
Loading the
base.js
file directly from google's git repository:http://closure-library.googlecode./git/closure/goog/base.js
;Eliminating the attempt to require
'goog.ui'
separately from any subponent thereof; andMoving 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.
本文标签: javascriptGoogle closure googrequire could not find googuiStack Overflow
版权声明:本文标题:javascript - Google closure: goog.require could not find: goog.ui - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745279882a2651373.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论