Message from discussion
Exposing dynamically created functions on objects
Received: by 10.50.40.230 with SMTP id a6mr5237974igl.2.1343650150341;
Mon, 30 Jul 2012 05:09:10 -0700 (PDT)
X-BeenThere: closure-compiler-discuss@googlegroups.com
Received: by 10.50.11.232 with SMTP id t8ls1567105igb.2.canary; Mon, 30 Jul
2012 05:09:07 -0700 (PDT)
Received: by 10.42.51.142 with SMTP id e14mr4316665icg.15.1343650147626;
Mon, 30 Jul 2012 05:09:07 -0700 (PDT)
Received: by 10.50.100.229 with SMTP id fb5msigb;
Mon, 30 Jul 2012 04:14:10 -0700 (PDT)
Received: by 10.68.228.134 with SMTP id si6mr1554505pbc.2.1343646850898;
Mon, 30 Jul 2012 04:14:10 -0700 (PDT)
Date: Mon, 30 Jul 2012 04:14:10 -0700 (PDT)
From: pgo...@gmail.com
To: closure-compiler-discuss@googlegroups.com
Cc: pgo...@gmail.com
Message-Id: <5ed21f70-119a-4362-9e1b-8dc3ef05687f@googlegroups.com>
In-Reply-To: <488e7498-13dd-4ba0-9b53-c75829cf4ee5@googlegroups.com>
References: <488e7498-13dd-4ba0-9b53-c75829cf4ee5@googlegroups.com>
Subject: Re: Exposing dynamically created functions on objects
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_354_5696682.1343646850570"
------=_Part_354_5696682.1343646850570
Content-Type: multipart/alternative;
boundary="----=_Part_355_13347538.1343646850570"
------=_Part_355_13347538.1343646850570
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
oops. Sorry. My bad
Thanks,
Gokul
On Friday, July 27, 2012 10:57:22 AM UTC+5:30, pgo...@gmail.com wrote:
>
> Hi,
>
> I am have just started learning javascript and the closure compiler
>
> I am trying to annotate my javascript so that closure doesnt rename all
> the exported 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 external javascript.
>
>
> Thanks,
>
> Gokul
>
------=_Part_355_13347538.1343646850570
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
oops. Sorry. My bad<div><br></div><div>Thanks,</div><div>Gokul<br><br>On Fr=
iday, July 27, 2012 10:57:22 AM UTC+5:30, pgo...@gmail.com wrote:<blockquot=
e class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: =
1px #ccc solid;padding-left: 1ex;"><p style=3D"font-size:14px;clear:both;wo=
rd-wrap:break-word;color:rgb(0,0,0);font-family:Arial,'Liberation Sans','De=
jaVu Sans',sans-serif;text-align:left">Hi,</p><p style=3D"font-size:14px;cl=
ear:both;word-wrap:break-word;color:rgb(0,0,0);font-family:Arial,'Liberatio=
n Sans','DejaVu Sans',sans-serif;text-align:left">I am have just started le=
arning javascript and the closure compiler<br></p><p style=3D"font-size:14p=
x;clear:both;word-wrap:break-word;color:rgb(0,0,0);font-family:Arial,'Liber=
ation Sans','DejaVu Sans',sans-serif;text-align:left">I am trying to annota=
te my javascript so that closure doesnt rename all the exported symbols sin=
ce i am working with vanilla javascript as well.</p><pre style=3D"margin-bo=
ttom:10px;padding:5px;font-size:14px;background-color:rgb(238,238,238);font=
-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sa=
ns Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;overflow:=
auto;width:auto;max-height:600px;color:rgb(0,0,0);line-height:18px;text-ali=
gn:left"><code style=3D"font-family:Consolas,Menlo,Monaco,'Lucida Console',=
'Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier Ne=
w',monospace,serif">/**
* @constructor
* @expose
* @type{foo}
*/
foo =3D function (el, args) {
"use strict";
var s =3D "Hello World";
/*
* @expose
* @this {foo}
* @type {function}
*/
this.introduce =3D function () {
return s;
};
};
</code></pre><p style=3D"font-size:14px;clear:both;word-wrap:break-word;col=
or:rgb(0,0,0);font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;=
text-align:left">However the generated output when i run it through the clo=
sure compiler with advanced optimization is</p><pre style=3D"margin-bottom:=
10px;padding:5px;font-size:14px;background-color:rgb(238,238,238);font-fami=
ly:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mo=
no','Bitstream Vera Sans Mono','Courier New',monospace,serif;overflow:auto;=
width:auto;max-height:600px;color:rgb(0,0,0);line-height:18px;text-align:le=
ft"><code style=3D"font-family:Consolas,Menlo,Monaco,'Lucida Console','Libe=
ration Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',mo=
nospace,serif">foo =3D function() {
this.a =3D function() {
return"Hello World"
</code></pre><p style=3D"font-size:14px;clear:both;word-wrap:break-word;col=
or:rgb(0,0,0);font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;=
text-align:left">} };</p><p style=3D"font-size:14px;clear:both;word-wrap:br=
eak-word;color:rgb(0,0,0);font-family:Arial,'Liberation Sans','DejaVu Sans'=
,sans-serif;text-align:left">How do i ask closure to preserve the name intr=
oduce since this will be called from an external javascript.</p><p style=3D=
"font-size:14px;clear:both;word-wrap:break-word;color:rgb(0,0,0);font-famil=
y:Arial,'Liberation Sans','DejaVu Sans',sans-serif;text-align:left"><br></p=
><p style=3D"font-size:14px;clear:both;word-wrap:break-word;color:rgb(0,0,0=
);font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;text-align:l=
eft">Thanks,</p><p style=3D"font-size:14px;clear:both;word-wrap:break-word;=
color:rgb(0,0,0);font-family:Arial,'Liberation Sans','DejaVu Sans',sans-ser=
if;text-align:left">Gokul</p></blockquote></div>
------=_Part_355_13347538.1343646850570--
------=_Part_354_5696682.1343646850570--