google-closure-library

Google closure variable window/event/console/… is undeclared error

◇◆丶佛笑我妖孽 提交于 2019-12-07 07:41:46
问题 I'm trying to compile one of my HTML5 project using Google Closure. I'm recieving several errors that I don't know how to solve. In fact, it's the same error but for different variables. Here the errors messages: variable window is undeclared variable event is undeclared variable console is undeclared variable Audio is undeclared These variables are Javascript built-in variables. If I compile this same project directly in command-line, it works. But, in my case, I need to compile this project

ignore compiler warning from one file in Google Closure

拈花ヽ惹草 提交于 2019-12-07 02:15:37
问题 I'm using an external library (Phonegap) in a fairly large Closure project. Unfortunately Phonegap generates a ton was compiler warnings (all "dangerous use of this"). Enough that it makes searching through the compiler output for warning about my own code pretty annoying. Is there a way to silence just the warnings from one file? 回答1: I suppose you mean type warnings when you are using VERBOSE or checkTypes. Put the following into any file: /** * @fileoverview * @suppress {checkTypes} */ to

Exposing dynamically created functions on objects with closure compiler

徘徊边缘 提交于 2019-12-06 22:01:38
I am trying to annotate my javascript so that closure doesnt rename all the symbols since i am working with vanilla javascript as well. /** * @constructor * @expose * @type{foo} */ foo = function (el, args) { "use strict"; var s = "Hello World"; /* * @expose * @this {foo} * @type {function} */ this.introduce = function () { return s; }; }; However the generated output when i run it through the closure compiler with advanced optimization is foo = function() { this.a = function() { return"Hello World" } }; How do i ask closure to preserve the name introduce since this will be called from an

How to configure karma-runner (also known as testacular) to work with closure-library

房东的猫 提交于 2019-12-06 05:57:40
问题 I'm trying to use karma-runner with mocha testing framework to test an application built with closure-library and angularjs. I always get namespace.Application is not defined thanks in advance. here's my config file basePath = ''; files = [ MOCHA, MOCHA_ADAPTER, {pattern: 'vendors/closure-library/closure/goog/base.js', watched: false, included: true, served: true}, {pattern: 'public/javascripts/deps.js', watched: true, included: true, served: true}, {pattern: 'node_modules/expect.js/expect.js

SHA512 not the same in CryptoJS and Closure

两盒软妹~` 提交于 2019-12-05 21:50:45
I have some troubles with a simple crypto-challenge. I want to do following: getting a url-encoded and base64-encoded value do url-decoding do base64-decoding hash with Sha512 When working with CryptoJS, i use following code: var parameter = "Akuwnm2318kwioasdjlnmn"; var urlDecoded = decodeURIComponent(parameter); var base64Decoded = CryptoJS.enc.Base64.parse(urlDecoded); var hashed = CryptoJS.SHA512(base64Decoded).toString(CryptoJS.enc.Base64); //hashed = "UxupkI5+dkhUorQ+K3+Tqct1WNUkj3I6N76g82CbNQ0EAH/nWjqi9CW5Qec1vq/qakNIYeXeqiAPOVAVkzf9mA=="

How do i add the authenticity token?

江枫思渺然 提交于 2019-12-05 20:00:34
问题 I recently switched to Google closure for a new project. I am having trouble adding the authenticity token to the headers in a ajax call. How do i go about it? My Ajax snippet (using goog.net.XhrIo class): var initialHTMLContent = superField[i].getCleanContents(); var data = goog.Uri.QueryData.createFromMap(new goog.structs.Map({ body: initialHTMLContent })); goog.net.XhrIo.send('/blogs/create', function(e) { var xhr = /** @type {goog.net.XhrIo} */ (e.target); alert(xhr.getResponseXml()); },

problems creating custom event dispatcher in google closure library

血红的双手。 提交于 2019-12-05 16:44:31
I'm trying to create a custom event dispatcher in google closure js library. I'm basing this code off of the animation class in the fx folder, yet I keep getting this error.. "goog.events is undefined" yet I'm including the events package at the top. here is my code. goog.provide('test.util.Animation'); goog.provide('test.util.Animation.EventType'); goog.provide('test.util.AnimationEvent'); goog.require('goog.events'); goog.require('goog.events.EventTarget'); goog.require('goog.events.EventType'); /** * Constructor for an animation object. * @constructor * @extends {goog.events.EventTarget} */

Google closure variable window/event/console/… is undeclared error

妖精的绣舞 提交于 2019-12-05 11:59:20
I'm trying to compile one of my HTML5 project using Google Closure. I'm recieving several errors that I don't know how to solve. In fact, it's the same error but for different variables. Here the errors messages: variable window is undeclared variable event is undeclared variable console is undeclared variable Audio is undeclared These variables are Javascript built-in variables. If I compile this same project directly in command-line, it works. But, in my case, I need to compile this project using an ant file (build process). My ant build script is using the same jar file that I use in

dynamic script tag loading is not working as expected

冷暖自知 提交于 2019-12-04 20:17:50
We have an application that uses both the google closure and dojo libraries. We have the following in our index page which works as expected: <script type="text/javascript" src="runtime/src/lib/google-closure-rev26/closure/goog/base.js"></script> <script type="text/javascript" src="runtime/src/lib/dojo_release_132_src/dojo/dojo.js"></script> <script type="text/javascript" src="runtime/src/core/loader.js"></script> We would like to use only one script tag in the actual html source. So we tried to do the following: <head> <script type="text/javascript" src="runtime/src-bootstrap.js"></script> <

How to configure karma-runner (also known as testacular) to work with closure-library

本小妞迷上赌 提交于 2019-12-04 11:15:41
I'm trying to use karma-runner with mocha testing framework to test an application built with closure-library and angularjs. I always get namespace.Application is not defined thanks in advance. here's my config file basePath = ''; files = [ MOCHA, MOCHA_ADAPTER, {pattern: 'vendors/closure-library/closure/goog/base.js', watched: false, included: true, served: true}, {pattern: 'public/javascripts/deps.js', watched: true, included: true, served: true}, {pattern: 'node_modules/expect.js/expect.js', watched: false, included: true, served: true}, {pattern: 'public/javascripts/*.js', watched: true,