google-closure-library

Why check for !isNaN() after isFinite()?

自古美人都是妖i 提交于 2019-12-20 09:39:51
问题 I came across the goog.math.isFiniteNumber function in the Google Closure Library. What it does is checking whether a given number is both finite and not NaN . The underlying code is: goog.math.isFiniteNumber = function(num) { return isFinite(num) && !isNaN(num); }; So, first it checks whether the number is finite using the native isFinite function, and then does an additional check to make sure the number isn't NaN using isNaN . However, isFinite already returns false in case the argument is

How to merge .CSS files with Sass (or other tool)? [duplicate]

柔情痞子 提交于 2019-12-18 07:29:13
问题 This question already has answers here : Import regular CSS file in SCSS file? (13 answers) Closed 4 years ago . I can use Sass to compile multiple .SCSS or .SASS input files into a single .CSS output file using @import as described here. If I use @import to include normal .CSS files, they are not merged. The output .CSS file still contains the @import directives. That makes sense. But is there a way I can override this behavior, perhaps a command-line switch to the Sass compiler? In other

How do I find out what functions are called when a button is pressed in Chrome Console?

若如初见. 提交于 2019-12-17 09:15:48
问题 I am trying to teach myself the Google Closure javascript library. I am examining the TreeControl UI widget. How can I use Chrome Console to analyze what functions are run when I click on the "Cut" button in the demo below? For instance, can I somehow set a break point for that? I've tried viewing the source and looking around, but I feel that Chrome Console may offer a more systematic method. https://github.com/google/closure-library/blob/master/closure/goog/demos/tree/demo.html 回答1: With

Why is my event listener written in Google Closure not working?

社会主义新天地 提交于 2019-12-13 16:02:39
问题 I have a function in my Google Closure code with an event listener that aims to append HTML generated by a soy template to the body when the body loads: /** * Constructs the home page. */ AppLoader.prototype.constructHomePage = function() { goog.events.listen(document.body, 'onload', function() { document.body.innerHTML = templates.home.main();}); } (new AppLoader()).constructHomePage(); However, it does not work. Chrome Console also offers no errors. What I have tried is the below code,

Is there any reason not to provide the same module in different source files?

╄→尐↘猪︶ㄣ 提交于 2019-12-13 15:34:32
问题 For example: // a.js goog.provide('mypackage.a'); goog.provide('mypackage.commands'); mypackage.a.somevar = 1; mypackage.commands.save = function(...) {...}; // b.js goog.provide('mypackage.b'); goog.provide('mypackage.commands'); mypackage.b.somevar = 1; mypackage.commands.read = function(...) {...}; // mypackage/commands.js goog.provide('mypackage.commands'); mypackage.commands.runCommand = function(commandText, args) { return mypackage.commands[commandText](args); } Is this a good way to

How to distribute a library which uses Closure-library without including any of the actual Closure-library source?

我与影子孤独终老i 提交于 2019-12-13 05:24:34
问题 I've recently created a JavaScript library using Google's Closure Compiler: https://github.com/bvaughn/task-runner I intend for this library to be used by applications that also require the full Closure Library , and so I want the built version of my library (Task Runner) not to include a subset of Closure Library. If Task Runner includes a subset of Closure Library, and another application includes the full Closure Library, a race condition will exist between which loads Closure last (last

Closure: --namespace Foo does not include Foo.Bar, and related issues

空扰寡人 提交于 2019-12-13 04:34:47
问题 I have a rather big library with a significant set of APIs that I need to expose. In fact, I'd like to expose the whole thing. There is a lot of namespacing going on, like: FooLibrary.Bar FooLibrary.Qux.Rumps FooLibrary.Qux.Scrooge .. Basically, what I would like to do is make sure that the user can access that whole namespace. I have had a whole bunch of trouble with this, and I'm totally new to closure, so I thought I'd ask for some input. First, I need closurebuilder.py to send the full

Activate a combobox from a checkbox using google closure

五迷三道 提交于 2019-12-13 04:22:31
问题 I have a set of check boxes with Id's user1,user2 and so on and also set of combo boxes with Id's usersel1,usersel2 and so on in a dialog. When a check box is checked (say suppose with Id user1) then corresponding combo box must be activated(i.e combo box with Id usersel1). I have the following code and isn't working. How do i achieve this behavior? for(var g=0;g<userlist.length;g++) //userlist.length give no of users b2 = (goog.dom.getElement('usersel'+(g+1))); //gets combo box //listening

depswriter.py complains 'The command line is too long'

孤街醉人 提交于 2019-12-13 00:12:00
问题 I tried to create deps.js file using 'closure-library\closure\bin\build\depswriter.py' in Windows 7. My python version is 2.7.3. Its complaining 'The command line is too long'. Its working perfectly fine in Linux. Any solution to make it work in windows. 回答1: To work around the Windows command-line limitation with depswriter.py , you can use the following flags to recursively scan directories for JavaScript files: --root A root directory to scan for JS source files. Paths of JS files in

Creating a Table Using Closure Tools

一曲冷凌霜 提交于 2019-12-12 11:49:43
问题 Can anyone help me in creating a table(grid layout) using closure Libray? Is there any widget available for it? I searched but din't find any! Please Help 回答1: As of May 2012, the Closure Library does not provide a table/grid layout component. There is a table sorter (see demo), but it only decorates traditional HTML tables. You might also want to take a look at the Visualization Table, which is part of Google Chart Tools. See the discussion on support for table/grid components in the Closure