Search Results

Search found 320 results on 13 pages for 'closure'.

Page 1/13 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Is Google Closure a true compiler?

    - by James Allardice
    This question is inspired by the debate in the comments on this Stack Overflow question. The Google Closure Compiler documentation states the following (emphasis added): The Closure Compiler is a tool for making JavaScript download and run faster. It is a true compiler for JavaScript. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. However, Wikipedia gives the following definition of a "compiler": A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language... A language rewriter is usually a program that translates the form of expressions without a change of language. Based on that, I would say that Google Closure is not a compiler. But the fact that Google explicitly state that it is in fact a "true compiler" makes me wonder if there's more to it. Is Google Closure really a JavaScript compiler?

    Read the article

  • Getting started with ClojureScript and Google Closure

    - by Andrea
    I would like to investigate whether ClojureScript, with the associated Google Closure library is a reasonable tool to build modern, in-browser, Javascript applications. My current Javascript stack consists of jQuery, Backbone and RequireJS with the possible additions of some widgets libraries like jQueryUI or KendoUI. So it will be quite a big leap (I already know how to work in Clojure, although I have little experience). What is a good roadmap to do so? Should I learn the Google Closure library first, or can I grasp it together with ClojureScript? One thing I am concerned about is the overall application structure. Backbone is rather opinionated on how to organize your application. I am not sure whether Google Closure also includes some components to help with the design of the application. And, if this is the case, I do not know how to tell whether this structure will port to ClojureScript or a ClojureScript application will require a different organization anyway, and only use - say - the widgets and DOM manipulation features of Closure.

    Read the article

  • Php error in closure compiler execution

    - by Mohammad
    When I run php-closure i get a PHP error Undefined index: HTTP_IF_NONE_MATCH in <b>/php-closure.php</b> on line <b>183</b> Line 184 of php-closure is trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) { This error only happens when closure has already written the compressed javascript file to the directory once, if the directory is emptied the error does not appear. What does this error mean and how can I avoid it? Thank You So Much!

    Read the article

  • How to use Google's Closure to compile JavaScript

    - by Ted
    Google just released Closure, which is a compiler to minify JavaScript. On the product site, it says "The Closure Compiler has also been integrated with Page Speed". How do I use Page Speed to compile my web pages JavaScript with Closure? (Or, is there a web site that I can simply paste in my JavaScript to have closure minify it?

    Read the article

  • Preventing closure compiler from renaming certain variables

    - by phidah
    I have a javascript file with a global object that must not be renamed (_gat from the Google Analytics async tracker). This object must not be renamed by the Google Closure Compiler as Google Analytics looks for a variable with this specific name. I've looked into the Javascript Doc notations that are mentioned: http://code.google.com/closure/compiler/docs/js-for-compiler.html - However, I cannot find anything regarding the "protection" of a variable. The problem exists no matter if I use simple or advanced compilation. How can I ensure that the _gat variable is not renamed?

    Read the article

  • When actually is a closure created?

    - by Jian Lin
    Is it true that a closure is created in the following cases for foo, but not for bar? Case 1: <script type="text/javascript"> function foo() { } </script> foo is a closure with a scope chain with only the global scope. Case 2: <script type="text/javascript"> var i = 1; function foo() { return i; } </script> same as Case 1. Case 3: <script type="text/javascript"> function Circle(r) { this.r = r; } Circle.prototype.foo = function() { return 3.1415 * this.r * this.r } </script> in this case, Circle.prototype.foo (which returns the circle's area) refers to a closure with only the global scope. (this closure is created). Case 4: <script type="text/javascript"> function foo() { function bar() { } } </script> here, foo is a closure with only the global scope, but bar is not a closure (yet), because the function foo is not invoked in the code, so no closure goo is ever created. It will only exist if foo is invoked , and the closure bar will exist until foo returns, and the closure bar will then be garbage collected, since there is no reference to it at all anywhere. So when the function doesn't exist, can't be invoked, can't be referenced, then the closure doesn't exist yet (never created yet). Only when the function can be invoked or can be referenced, then the closure is actually created?

    Read the article

  • How to auto-generate externs for the Google Closure Compiler

    - by ivo
    Suppose you are working in a javascript project with several external library dependencies, and want to compile your sources using the Google Closure Compiler in ADVANCED_OPTIMIZATIONS mode. Since in this mode the compiler will rename your code calls to the external libraries objects and functions, you must provide externs, to prevent this renaming from happening. But, it is a lot of work to produce the externs by hand, so, what is the best way to auto-generate the appropriate extern from a given javascript lib?

    Read the article

  • When to use closure?

    - by shahkalpesh
    I have seen samples of closure from - http://stackoverflow.com/questions/36636/what-is-a-closure Can anyone provide simple example of when to use closure? Specifically, scenarios in which closure makes sense? Lets assume that the language doesn't have closure support, how would one still achieve similar thing? Not to offend anyone, please post code samples in a language like c#, python, javascript, ruby etc. I am sorry, I do not understand functional languages yet.

    Read the article

  • Does Mootools prevents javascript closure 100%?

    - by terrani
    Hi, While I was talking about javascript closure to my friend, I was told that using Mootools can prevent closures 100%. To my knowledege, a variable causes a closure. How does Mootools itself prevents javascript closure? I think my friend is sayting that Mootools' functions are closure-safe functions. Any suggestions?

    Read the article

  • How to make php closure compiler write to a predefined file name?

    - by Mohammad
    I'm quite embarrassed to ask this but I've been trying to figure it out all day with no luck. http://code.google.com/p/php-closure/source/browse/trunk/php-closure.php on Line 172 the write() function get the md5 encoded name via the _getHash() function on Line 276. I was wondering how I could alter this code to write the compiled code to a predefined name like copiled_code.js I've tried altering the _getCacheFileName() function on Line 272 to this function _getCacheFileName() { //return $this->_cache_dir . $this->_getHash() . ".js"; return 'copiled_code.js'; } without any results. Thanks to all of you in advance!

    Read the article

  • Bind a java class as a closure into a groovy-script

    - by chrsk
    Is it possible to bind a closure written in java into a groovy-script. Is there an interface or something to implement so i can provide a closure? Something like this? public class Example implements Closure { public void closure(Object... args) { System.out.println(args[0]); } } Bind this into the groovyscript. Binding binding = new Binding(); binding.put("example", new Example()); groovyScriptEngine.run("foo.groovy", binding) and use it in the foo.groovy like this: example("Hello World")

    Read the article

  • Why does Google's Closure Compiler leave a few unnecessary spaces or line breaks?

    - by Bungle
    I've noticed that every time I use Google's Closure Compiler Service, it leaves a few unnecessary spaces in the compiled code presented on the right-hand side of the page. These correspond to line breaks in the hosted version of the compiled code. For example (note the line breaks, each of which seems unnecessary): http://troy.onespot.com/static/stack_overflow/closure_spaces.js To date, I've just been removing them manually, but I'm curious why they're there. Is it to limit the line length of the hosted version of the code to make it more readable? Could the compiler be smart enough to leave or insert those intentionally to maximize GZIP compression efforts? I know that they have a trivial effect on the file size, but with so much effort going into minifying every last byte in the source script, it's counterintuitive why they're there.

    Read the article

  • How to make php-closure compiler output to a predefined file name? (Updated)

    - by Mohammad
    Php-closure compiler (linked to source code) currently writes the compiled code to a md5 encoded filename. How can I make it so it write the compiled code to a predefined name like compiled_code.js? . . I think it has to do with the write() function on Line 164. It gets the filename via the _getCacheFileName() function (Line 272). function _getCacheFileName() { return $this->_cache_dir . $this->_getHash() . ".js"; } I've tried altering it to this: function _getCacheFileName() { //return $this->_cache_dir . $this->_getHash() . ".js"; return 'copiled_code.js'; } without any results. Thanks to all of you in advance!

    Read the article

  • Google Closure: Setting Input for AutoComplete Dynamically

    - by amuzed
    The Google Closure (GC) Javascript Library makes it very easy to create an AutoComplete UI, as this demo shows - http://closure-library.googlecode.com/svn/trunk/closure/goog/demos/autocomplete-basic.html . Basically, all we have to do is define an array and pass it on as one of the parameters. I'd like to be able to update the array dynamically and have AutoComplete show the changes immediately. Example, if there are two arrays list1 = ["One", "Two", "Three"] list2 = ["1", "2", "3"] and an AutoComplete has been initialized using list1, var suggest = new goog.ui.AutoComplete.Basic(list1, document.getElementById('input'), false); how can I update the existing AutoComplete (suggest) to use list2?

    Read the article

  • Google I/O 2010 - Opening up Closure Library

    Google I/O 2010 - Opening up Closure Library Google I/O 2010 - Opening up Closure Library Tech Talks Nathan Naze Closure Library is the open-source JavaScript library behind some of Google's big web apps like Gmail and Google Docs. This session will tour the broad library, its object-oriented design, and its namespaced organization. We'll explain how it works and how to integrate it in your setup, both for development and optimized for a live application using Closure Compiler. For all I/O 2010 sessions, please go to code.google.com From: GoogleDevelopers Views: 116 0 ratings Time: 01:00:38 More in Science & Technology

    Read the article

  • Google Closure Library - Adding non-TreeNode children to a TreeNode

    - by Andreas Jansson
    Hi, I'm using the Google Closure Library and goog.ui.tree in particular to build a tree structure GUI component. It works pretty well out of the box, but I'd like to add a few extra controls to each of the leaves (goog.ui.Checkboxes in particular). The problem is that Component.addChild has been overridden in BaseNode so that each added child is treated as a child tree node as opposed to a child component. In effect plenty of errors are thrown if you try to add anything else than an actual tree node as a child, as these children are traversed and BaseNode-specific functions are called on them. I must admit I'm quite a Closure newb, but I reckon there must be some workaround for this, right? Essentially all I want to do is have a bunch of checkboxes appear next to each leaf in my tree. Thanks, Andreas

    Read the article

  • How to prevent Closure Compiler from renaming "true", "false" and "null"

    - by Armagan Amcalar
    Google Closure Compiler renames all "true", "false" and "null" occurences in code like; var s = true, x = null, V = false; and uses these shorthands instead; in conditions such as; if (someVariable == s) now; Google Analytics code defines it's own "s" variable; overriding the value "true"; and as you can see this causes a lot of problems. I don't want to change GA code; I just want Closure Compiler to quit renaming true etc. Externs do not work. Do you know any way to accomplish this?

    Read the article

  • Documentation generator for Google Closure Javascript

    - by Julius Eckert
    I want to generate a HTML-Documentation for my Javascript code. The comments in my code are written in a format, the Google Closure Compiler can use to optimize my code. Example: /** * Class for handling timing events. * * @param {number=} opt_interval Number of ms between ticks (Default: 1ms). * @param {Object=} opt_timerObject An object that has setTimeout, setInterval, * clearTimeout and clearInterval (eg Window). * @constructor * @extends {goog.events.EventTarget} */ goog.Timer = function(opt_interval, opt_timerObject) { ... } I am looking for something like http://yardoc.org for Javascript. What tools can you recommend? Are there any specific tools for Google Closure code?

    Read the article

  • Choosing MooTools over Google closure?

    - by Shekhar
    I am in a process to select javascript library for our new web application. This app is not very UI heavy but has forms, reports, search, calendars, tabs and target multiple countries like most web apps. We are a tiny team. Biggest concern is maintainability and readability of the code. We are Python programmers. After evaluating many other javascript frameworks we have narrowed down to mootools and google-closure. We loved mootools syntax. It took us no time to learn. It's like Python. On other hand we were stumped seeing private/public in google closure. It's tempting to go for mootools however, I would love to hear from you about specific advantages these frameworks offer over each other.

    Read the article

  • define a closure as method from class

    - by user272839
    Hi, i'm trying to play with php5.3 and closure. I see here (Listing 7. Closure inside an object : http://www.ibm.com/developerworks/opensource/library/os-php-5.3new2/index.html) that it's possible to use $this in the callback function, but it's not. So I try to give $this as use variable : $self = $this; $foo = function() use($self) { //do something with $self } So to use the same example : class Dog { private $_name; protected $_color; public function __construct($name, $color) { $this->_name = $name; $this->_color = $color; } public function greet($greeting) { $self = $this; return function() use ($greeting, $self) { echo "$greeting, I am a {$self->_color} dog named {$self->_name}."; }; } } $dog = new Dog("Rover","red"); $dog->greet("Hello"); Output: Hello, I am a red dog named Rover. First of all this example does not print the string but return the function, but that's not my problem. Secondly I can't access to private or protected, because the callback function is a global function and not in the context from the Dog object. Tha't my problem. It's the same as : function greet($greeting, $object) { echo "$greeting, I am a {$self->_color} dog named {$self->_name}."; } And I want : public function greet($greeting) { echo "$greeting, I am a {$self->_color} dog named {$self->_name}."; } Which is from Dog and not global. I hope that I am clear ...

    Read the article

  • Google Closure minifier online?

    - by Geuis
    Has anyone setup an online copy/paste utility for Google's Closure minifier? I'm working on a project and I want to minify part of the code manually without having to setup the entire project on my own.

    Read the article

  • Closure Library with ASP.NET

    - by jarrett
    Google's Closure Library looks like it has a lot of great features, but I'm not seeing any examples of it used with ASP.NET sites. I'm just wondering if anyone has any experience using the two together and what parts. Is is a good or bad experience?

    Read the article

  • Google I/O 2011: JavaScript Programming in the Large with Closure Tools

    Google I/O 2011: JavaScript Programming in the Large with Closure Tools Michael Bolin Most developers who have tinkered with JavaScript could not imagine writing 1000 lines of code in such a language, let alone 100000. Yet that is exactly what Google engineers have done using a suite of JavaScript tools named "Closure" to produce many of the most popular and sophisticated applications on the Web, such as Gmail and Google Maps. From: GoogleDevelopers Views: 4915 35 ratings Time: 57:07 More in Science & Technology

    Read the article

  • getting started with Google Closure if you don't care about minifying/compiling?

    - by Tim
    If you don't care about minifying your code, is there a way to get started using the Google Closure library without having to set up a subversion client and use the compiler? The Notepad sample program on Google's website refers to <script src="closure-library/base.js" > </script > Can you simply download closure-library/base.js somewhere and start playing with the UI examples? The Closure Lite quick-start version doesn't appear to include goog.ui

    Read the article

  • getting started with Google Closure if you don't compare about minifying/compiling?

    - by Tim
    If you don't care about minifying your code, is there a way to get started using the Google Closure library without having to set up a subversion client and use the compiler? The Notepad sample program on Google's website refers to <script src="closure-library/base.js" > </script > Can you simply download closure-library/base.js somewhere and start playing with the UI examples? The Closure Lite quick-start version doesn't appear to include goog.ui

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >