{"id":12000,"date":"2012-11-28T21:00:40","date_gmt":"2012-11-28T12:00:40","guid":{"rendered":"http:\/\/www.sssg.org\/blogs\/hiro345\/?p=12000"},"modified":"2012-12-13T18:40:52","modified_gmt":"2012-12-13T09:40:52","slug":"clojure-compiler%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6javascript%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%a0%e3%81%ae%e6%9c%80%e9%81%a9%e5%8c%96","status":"publish","type":"post","link":"https:\/\/www.hiro345.net\/blogs\/hiro345\/archives\/12000.html","title":{"rendered":"Clojure Compiler\u3092\u4f7f\u3063\u3066JavaScript\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u6700\u9069\u5316"},"content":{"rendered":"<p><a href=\"https:\/\/developers.google.com\/closure\/compiler\/\">Closure Tools \u2014 Google Developers<\/a>\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u308bClojure Compiler\u3092\u4f7f\u3046\u3068\u3001JavaScript\u304b\u3089\u4f59\u8a08\u306a\u7a7a\u767d\u3084\u30b3\u30e1\u30f3\u30c8\u3092\u7c21\u5358\u306b\u53d6\u308a\u9664\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n<!--more--><br \/>\n\u30b5\u30a4\u30c8\u304b\u3089compiler-latest.zip\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u5c55\u958b\u3059\u308b\u3068compiler.jar\u304c\u624b\u306b\u5165\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u4e0b\u8a18\u306e\u3088\u3046\u306b\u3057\u3066\u5b9f\u884c\u3057\u307e\u3059\u3002sample7.js\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u3066sample7-compiled.js\u3092\u751f\u6210\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; gutter: true\">\r\n$ java -jar compiler.jar --js sample7.js --js_output_file sample7-compiled.js\r\n<\/pre>\n<p>\u3053\u3053\u3067\u3001sample7.js\u306f\u6b21\u306e\u5185\u5bb9\u3067\u3059\u3002<\/p>\n<pre class=\"brush: js; gutter: true\">\r\n\/\/ \u30b5\u30f3\u30d7\u30eb\r\nvar INTERVAL=1000;\r\nvar COUNT_MAX=30;\r\n\r\n\/\/ HTML\u8981\u7d20\r\nvar target1 = document.getElementById(&quot;target1&quot;);\r\nvar target2 = document.getElementById(&quot;target2&quot;);\r\nvar target3 = document.getElementById(&quot;target3&quot;);\r\nvar current_width2 = 0;\r\nvar current_width3 = 0;\r\nvar target2_timer_id = 0;\r\nvar target3_timer_id = 0;\r\n\r\n\/**\r\n * \u30ed\u30b0\u7528\u95a2\u6570\r\n *\/\r\nfunction log(message) {\r\n  document.getElementById(&#039;log&#039;).innerHTML = message;\r\n}\r\n\r\n\/**\r\n * runner\u505c\u6b62\u5224\u5b9a\u7528\u5909\u6570\r\n *\/\r\nvar cnt=0;\r\n\r\n\/**\r\n * setInterval\u3067\u5b9a\u671f\u7684\u306b\u547c\u3070\u308c\u308b\u51e6\u7406\r\n *\/\r\nfunction runner(time_value) {\r\n  if (cnt &gt; COUNT_MAX) {\r\n    clearInterval(id);\r\n    return;\r\n  }\r\n  if (cnt == 5) {\r\n    var target2_timer_id = setInterval(function() {\r\n      current_width2 += 20;\r\n      target2.style.width = current_width2 + &#039;px&#039;;\r\n      if (current_width2 &gt; 400) {\r\n          clearInterval(target2_timer_id);\r\n      }\r\n    }, INTERVAL\/2);\r\n  }\r\n  if (cnt == 10) {\r\n    var target3_timer_id = setInterval(function() {\r\n      current_width3 += 20;\r\n      target3.style.width = current_width3 + &#039;px&#039;;\r\n      if (current_width3 &gt; 800) {\r\n          clearInterval(target3_timer_id);\r\n      }\r\n    }, INTERVAL\/10);\r\n  }\r\n  var v = cnt + &#039;:&#039; + time_value;\r\n  target1.innerHTML = v;\r\n  cnt++;\r\n}\r\n\r\n\/**\r\n * \u30e1\u30a4\u30f3\u51e6\u7406\u306e\u5b9f\u884c\r\n *\/\r\nvar id = setInterval(function() {\r\n    var time_value = (new Date()).getTime();\r\n    runner(time_value);\r\n  }, INTERVAL);\r\n<\/pre>\n<p>\u3053\u308c\u304c\u3001sample7-compiled.js\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u3082\u306e\u3059\u3054\u304f\u5727\u7e2e\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: js; gutter: true\">\r\nvar INTERVAL=1E3,COUNT_MAX=30,target1=document.getElementById(&quot;target1&quot;),target2=document.getElementById(&quot;target2&quot;),target3=document.getElementById(&quot;target3&quot;),current_width2=0,current_width3=0,target2_timer_id=0,target3_timer_id=0;function log(a){document.getElementById(&quot;log&quot;).innerHTML=a}var cnt=0;\r\nfunction runner(a){if(cnt&gt;COUNT_MAX)clearInterval(id);else{if(5==cnt)var b=setInterval(function(){current_width2+=20;target2.style.width=current_width2+&quot;px&quot;;400&lt;current_width2&amp;&amp;clearInterval(b)},INTERVAL\/2);if(10==cnt)var c=setInterval(function(){current_width3+=20;target3.style.width=current_width3+&quot;px&quot;;800&lt;current_width3&amp;&amp;clearInterval(c)},INTERVAL\/10);target1.innerHTML=cnt+&quot;:&quot;+a;cnt++}}var id=setInterval(function(){var a=(new Date).getTime();runner(a)},INTERVAL);\r\n<\/pre>\n<p>\u300c<a href=\"http:\/\/closure-compiler.appspot.com\/home\">Closure Compiler Service<\/a>\u300d\u3078\u30a2\u30af\u30bb\u30b9\u3059\u308c\u3070\u3001Web\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u3082\u4f7f\u3048\u307e\u3059\u3002<\/p>\n<p>JavaScript\u306b\u3064\u3044\u3066\u306f\u3001\u4e0b\u8a18\u306e\u66f8\u7c4d\u306e\u53c2\u8003\u306b\u306a\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<ul>\n<li><a type=amzn asin=\"4274066606\">JavaScript\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u5165\u9580 \u7b2c2\u7248<\/a><\/li>\n<li><a type=\"amzn\" asin=\"4774152439\">JavaScript\u30c6\u30af\u30cb\u30c3\u30af\u30d0\u30a4\u30d6\u30eb ~\u52b9\u7387\u7684\u306a\u958b\u767a\u306b\u5f79\u7acb\u3064150\u306e\u6280<\/a><\/li>\n<\/ul>\n<div>\n<iframe src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&#038;o=9&#038;p=8&#038;l=as1&#038;asins=4274066606&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr\" style=\"width:120px;height:240px;\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"><\/iframe><iframe src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&#038;o=9&#038;p=8&#038;l=as1&#038;asins=4774152439&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr\" style=\"width:120px;height:240px;\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"><\/iframe><\/p>\n<p>\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u4e00\u822c\u306b\u3064\u3044\u3066\u306f\u3001\u4e0b\u8a18\u304c\u53c2\u8003\u306b\u306a\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<ul>\n<li>\u30af\u30e9\u30b9\u30d9\u30fc\u30b9\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u57fa\u790e\u3092\u5b66\u3076\u306b\u306f &#8230; <a type=\"amzn\" asin=\"484432523X\">\u6539\u8a02\u7248 \u57fa\u790eJava(CD-ROM\u4ed8) (IMPRESS KISO SERIES)<\/a><\/li>\n<li>\u30af\u30e9\u30b9\u30d9\u30fc\u30b9\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3092\u5b66\u3076\u306b\u306f &#8230; <a type=\"amzn\" asin=\"4894717166\">\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9eJava (The Java Series)<\/a><\/li>\n<li>\u95a2\u6570\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3092\u5b66\u3076\u306b\u306f &#8230; <a type=\"amzn\" asin=\"4844330845\">Scala\u30b9\u30b1\u30fc\u30e9\u30d6\u30eb\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u7b2c2\u7248<\/a><\/li>\n<li>\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u7406\u8ad6\u3092\u5b66\u306b\u306f &#8230; <a type=\"amzn\" asin=\"4781912850\">\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u57fa\u790e\u6982\u5ff5 (\u30e9\u30a4\u30d6\u30e9\u30ea\u60c5\u5831\u5b66\u30b3\u30a2\u30fb\u30c6\u30ad\u30b9\u30c8) <\/a><\/li>\n<\/ul>\n<p><iframe src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&#038;o=9&#038;p=8&#038;l=as1&#038;asins=484432523X&#038;ref=tf_til&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr\" style=\"width:120px;height:240px;\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"><\/iframe><iframe src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&#038;o=9&#038;p=8&#038;l=as1&#038;asins=4894717166&#038;ref=tf_til&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr\" style=\"width:120px;height:240px;\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"><\/iframe><iframe src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&#038;o=9&#038;p=8&#038;l=as1&#038;asins=4844330845&#038;ref=tf_til&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr\" style=\"width:120px;height:240px;\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"><\/iframe><iframe src=\"\/\/rcm-jp.amazon.co.jp\/e\/cm?t=hiro345-22&#038;o=9&#038;p=8&#038;l=as1&#038;asins=4781912850&#038;ref=tf_til&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr\" style=\"width:120px;height:240px;\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"><\/iframe>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Closure Tools \u2014 Google Developers\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u308bClojure Compiler\u3092\u4f7f\u3046\u3068\u3001JavaScript\u304b\u3089\u4f59\u8a08\u306a\u7a7a\u767d\u3084\u30b3\u30e1\u30f3\u30c8\u3092\u7c21\u5358\u306b\u53d6\u308a\u9664\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[31],"class_list":["post-12000","post","type-post","status-publish","format-standard","hentry","category-program","tag-javascript"],"_links":{"self":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/12000","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/comments?post=12000"}],"version-history":[{"count":4,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/12000\/revisions"}],"predecessor-version":[{"id":12012,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/12000\/revisions\/12012"}],"wp:attachment":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/media?parent=12000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/categories?post=12000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/tags?post=12000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}