{"id":9928,"date":"2019-04-23T06:15:04","date_gmt":"2019-04-22T21:15:04","guid":{"rendered":"https:\/\/www.suzukikenichi.com\/blog\/?p=9928"},"modified":"2019-04-23T06:07:36","modified_gmt":"2019-04-22T21:07:36","slug":"amp-script-component-gives-you-the-ability-to-run-javascript-from-within-an-amp-document","status":"publish","type":"post","link":"https:\/\/www.suzukikenichi.com\/blog\/amp-script-component-gives-you-the-ability-to-run-javascript-from-within-an-amp-document\/","title":{"rendered":"\u72ec\u81ea\u306eJavaScript\u3092AMP\u3067\u52d5\u304b\u305b\u308b&lt;amp-script&gt;\u304c\u516c\u958b\u3002\u30aa\u30ea\u30b8\u30f3\u30c8\u30e9\u30a4\u30a2\u30eb\u53c2\u52a0\u52df\u96c6\u4e2d #AMPConf"},"content":{"rendered":"<p class=\"p20-b al-r small\">[\u30ec\u30d9\u30eb: \u4e0a\u7d1a]<\/p>\n<p>AMP \u3067\u306f\u3001JavaScript \u306e\u5229\u7528\u304c\u53b3\u3057\u304f\u5236\u9650\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\u539f\u5247\u7684\u306b\u3001\u72ec\u81ea\u306e JavaScript \u306e\u5b9f\u884c\u306f\u8a31\u53ef\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u72ec\u81ea\u306e JavaScript \u3092 AMP \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u306a\u304b\u3067\u5229\u7528\u53ef\u80fd\u306b\u3059\u308b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u516c\u958b\u3055\u308c\u307e\u3057\u305f\u3002<br \/>\u305d\u308c\u304c\u3001<code>&lt;amp-script&gt;<\/code> \u3067\u3059\u3002<\/p>\n<p>\u6771\u4eac\u306e\u516d\u672c\u6728\u3067 4 \u6708 17 \u301c 18 \u65e5\u306b\u958b\u50ac\u3055\u308c\u305f AMP Conf 2019 \u306e\u57fa\u8abf\u8b1b\u6f14\u3067\u521d\u516c\u958b\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<div class=\"p60-b\"><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/1vwOFt9FBm4?start=334\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/div>\n<h2>Worker DOM \u3067\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u4f4e\u4e0b\u3055\u305b\u305a\u306b \u72ec\u81ea JS \u3092 AMP \u3067\u5b9f\u884c<\/h2>\n<p><code>&lt;amp-script&gt;<\/code> \u306e<a href=\"https:\/\/amp.dev\/documentation\/components\/amp-script\">\u6280\u8853\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u306f\u3059\u3067\u306b AMP \u516c\u5f0f\u30b5\u30a4\u30c8\u3067\u63d0\u4f9b\u3055\u308c\u3066\u3044\u307e\u3059\uff08\u3061\u306a\u307f\u306b\u3001AMP \u95a2\u9023\u306e\u30b5\u30a4\u30c8\u306f\u3001<a href=\"https:\/\/amp.dev\/\">amp.dev<\/a> \u3068\u3044\u3046\u30c9\u30e1\u30a4\u30f3\u540d\u306e\u65b0\u3057\u3044\u30b5\u30a4\u30c8\u306b AMP Conf \u76f4\u524d\u306b\u7d71\u5408\u3055\u308c\u307e\u3057\u305f\uff09\u3002<\/p>\n<p>AMP \u304c \u72ec\u81ea JavaScript \u3092\u4f7f\u308f\u305b\u306a\u3044\u7406\u7531\u306f\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u843d\u3068\u3055\u306a\u3044\u3053\u3068\u304c\u3044\u3061\u3070\u3093\u306e\u7406\u7531\u3067\u3059\u3002<br \/>\u305d\u3053\u3067\u3001JavaScript \u3092\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3068\u306f\u5225\u306e\u30d7\u30ed\u30bb\u30b9\u3067\u53ef\u52d5\u3055\u305b\u308b <a href=\"https:\/\/www.suzukikenichi.com\/blog\/js-in-amp-with-web-worker\/\">Worked DOM<\/a> \u306e\u6280\u8853\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u6280\u8853\u7684\u306a\u8a73\u3057\u3044\u5185\u5bb9\u306b\u8208\u5473\u304c\u3042\u308b\u65b9\u306f\u3001AMP Conf \u3067\u306e\u95a2\u9023\u30bb\u30c3\u30b7\u30e7\u30f3\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/sYXkVOiz77I\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p class=\"p30-t\">AMP \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e Twitter \u516c\u5f0f\u30a2\u30ab\u30a6\u30f3\u30c8\u304c\u6295\u7a3f\u3057\u305f\u3053\u3061\u3089\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306f <code>&lt;amp-script&gt;<\/code> \u3092\u5b9f\u88c5\u3057\u3066\u4f5c\u6210\u3057\u305f\u305d\u3046\u3067\u3059\u3002<\/p>\n<div class=\"p40-b\">\n<blockquote class=\"twitter-tweet\" data-lang=\"ja\">\n<p lang=\"en\" dir=\"ltr\">JavaScript is coming to AMP! &#x1f44f; &#x1f389;<\/p>\n<p>With &#39;amp-script&#39;, custom <a href=\"https:\/\/twitter.com\/hashtag\/JS?src=hash&amp;ref_src=twsrc%5Etfw\">#JS<\/a> can operate within AMP Documents. Don&#39;t believe us? The animation below was built using AMP Script! <\/p>\n<p>Tune into <a href=\"https:\/\/twitter.com\/hashtag\/AMPConf?src=hash&amp;ref_src=twsrc%5Etfw\">#AMPConf<\/a> April 17-18 to learn more and see how it&#39;s done.<\/p>\n<p>More info here &#x1f449; <a href=\"https:\/\/t.co\/dWISodWsdI\">https:\/\/t.co\/dWISodWsdI<\/a> <a href=\"https:\/\/t.co\/PteziUS11f\">pic.twitter.com\/PteziUS11f<\/a><\/p>\n<p>&mdash; AMP Project (@AMPhtml) <a href=\"https:\/\/twitter.com\/AMPhtml\/status\/1116378847937613824?ref_src=twsrc%5Etfw\">2019\u5e744\u670811\u65e5<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/div>\n<h2>\u30c8\u30e9\u30a4\u30a2\u30eb\u958b\u59cb<\/h2>\n<p><code>&lt;amp-script&gt;<\/code> \u306f\u6b63\u5f0f\u306b\u516c\u958b\u3055\u308c\u305f\u308f\u3051\u3067\u306f\u306a\u304f\u3001\u30c8\u30e9\u30a4\u30a2\u30eb\u304c\u59cb\u307e\u3063\u305f\u3070\u304b\u308a\u3067\u3059\u3002<\/p>\n<p>\u72ec\u81ea\u306e JS \u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3068\u3044\u3063\u3066\u3082\u901a\u5e38\u306e\u30a6\u30a7\u30d6\u30da\u30fc\u30b8\u3068\u307e\u3063\u305f\u304f\u540c\u3058\u3088\u3046\u306b\u7121\u6761\u4ef6\u3067\u3069\u3093\u306a JS \u3082\u8a31\u5bb9\u3059\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<br \/>\u305f\u3068\u3048\u3070\u3001\u6b21\u306e\u5236\u7d04\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>150 KB \u4ee5\u5185<\/li>\n<li>5\u79d2\u4ee5\u4e0a\u306e Mutation \u304c\u5fc5\u8981\uff08\u4f8b\u5916\u3042\u308a\uff09<\/li>\n<\/ul>\n<p>\u305d\u308c\u3067\u3082\u3001\u81ea\u5206\u304c\u66f8\u3044\u305f JS \u304c AMP \u3067\u52d5\u304b\u305b\u308b\u3088\u3046\u306b\u306a\u308b\u306e\u306f\u81ea\u7531\u5ea6\u304c\u305c\u3093\u305c\u3093\u9055\u3063\u3066\u304d\u307e\u3059\u3002<br \/>\u3088\u308a\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u306a\u6a5f\u80fd\u3092 AMP \u30da\u30fc\u30b8\u306b\u6301\u305f\u305b\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u4e0a\u3067\u89e6\u308c\u305f\u5236\u7d04\u3082\u542b\u3081\u3066\u6700\u7d42\u7684\u306a\u4ed5\u69d8\u306f\u30c8\u30e9\u30a4\u30a2\u30eb\u3092\u7d4c\u3066\u4eca\u5f8c\u4fee\u6b63\u304c\u52a0\u3048\u3089\u308c\u308b\u3053\u3068\u3082\u3042\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<p class=\"p40-b\"><code>&lt;amp-script&gt;<\/code> \u306e\u30aa\u30ea\u30b8\u30f3 \u30c8\u30e9\u30a4\u30a2\u30eb\u53c2\u52a0\u8005\u306e\u52df\u96c6\u3092 <a href=\"https:\/\/twitter.com\/AMPhtml\/status\/1118907037025546240\">AMP \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304c\u958b\u59cb<\/a>\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\u3044\u3061\u65e9\u304f\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u3044\u3046\u958b\u767a\u8005\u306e\u65b9\u306f\u5fdc\u52df\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<br \/><a href=\"https:\/\/docs.google.com\/forms\/d\/e\/1FAIpQLSdcsZ6VL-800bmluMRz2DYU8rEC7j_4HHY2C8LKor-Cu7xWyg\/viewform\">\u3053\u3061\u3089\u306e\u30d5\u30a9\u30fc\u30e0\u304b\u3089<\/a>\u7533\u3057\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<h2>Next.js \u304c AMP \u3092\u30b5\u30dd\u30fc\u30c8<\/h2>\n<p>JavaScript \u7e4b\u304c\u308a\u3067\u3001\u958b\u767a\u8005\u304c\u8208\u596e\u3057\u305d\u3046\u306a\u30cb\u30e5\u30fc\u30b9\u3092\u3082\u3046 1 \u3064\u304a\u4f1d\u3048\u3057\u307e\u3059\u3002<\/p>\n<p>React \u306e SSR\uff08\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\uff09\u3068\u3057\u3066\u5e45\u5e83\u304f\u4f7f\u308f\u308c\u3066\u3044\u308b <a href=\"https:\/\/nextjs.org\/blog\/next-8-1\">Next.js \u304c\u30d0\u30fc\u30b8\u30e7\u30f3 8.1 \u3067 AMP \u3092\u30b5\u30dd\u30fc\u30c8<\/a>\u3059\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>React\/Next.js \u3067\u30b5\u30a4\u30c8\u3092\u69cb\u6210\u3057\u3066\u3044\u3066\u3001\u3055\u3089\u306b AMP \u5bfe\u5fdc\u3057\u3066\u3044\u308b\u30b5\u30a4\u30c8\u306f\u5229\u7528\u53ef\u80fd\u304b\u3069\u3046\u304b\u3092\u8abf\u3079\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<br \/><a href=\"https:\/\/nextjs.org\/learn\/excel\/amp\">\u6280\u8853\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u3053\u3061\u3089\u3067<\/a>\u5165\u624b\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b Next.js \u306f\u3001\u81ea\u5206\u305f\u3061\u304c\u898b\u672c\u3068\u306a\u308b\u3079\u304f\u30b5\u30a4\u30c8\u5168\u4f53\u3092 AMP \u5316\u3055\u305b\u307e\u3057\u305f\u3002<\/p>\n<p class=\"p60-t\">\u30a6\u30a7\u30d6\u306e 3 \u5927\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u3042\u308b\u3002HTML\u30fbCSS\u30fbJavaScript \u306e\u3046\u3061 JavaScript \u306f\u7279\u306b\u81ea\u7531\u5ea6\u304c\u4f4e\u304f\u6291\u3048\u3089\u308c\u3066\u3044\u307e\u3057\u305f\u3002<br \/>AMP \u63a1\u7528\u306e\u59a8\u3052\u306e 1 \u3064\u3067\u3059\u3002<br \/><code>&lt;amp-script&gt;<\/code> \u304c\u6b63\u5f0f\u306b\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308c\u3070 AMP \u304c\u3055\u3089\u306b\u5229\u7528\u3057\u3084\u3059\u304f\u306a\u308b\u3067\u3057\u3087\u3046\u3002<br \/>\u4eca\u5f8c\u306e\u9032\u5c55\u306b\u8981\u6ce8\u76ee\u3067\u3059\u3002<\/p>\n<div><script type=\"application\/ld+json\">[{\"@context\":\"https:\/\/schema.org\",\"@type\":\"VideoObject\",\"name\":\"\u57fa\u8abf\u8b1b\u6f14\uff08AMP Conf '19\uff09\",\"description\":\"2019 \u5e74\u5ea6\u306e AMP \u30ab\u30f3\u30d5\u30a1\u30ec\u30f3\u30b9\uff08AMP Conf\uff09\u3078\u3088\u3046\u3053\u305d\uff01AMP \u30c1\u30fc\u30e0\u304c\u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u30fc\u3068\u5171\u306b\u3001\u6570\u3005\u306e\u6700\u65b0\u60c5\u5831\u3084\u516c\u958b\u3092\u7686\u3055\u3093\u306b\u559c\u3093\u3067\u304a\u5c4a\u3051\u3057\u307e\u3059\u30022019 \u5e74\u4ee5\u964d\u306e\u8a08\u753b\u3092\u3001\u6771\u4eac\u304b\u3089\u306e\u30e9\u30a4\u30d6\u914d\u4fe1\u3067\u304a\u805e\u304d\u304f\u3060\u3055\u3044\uff01\",\"thumbnailUrl\":[\"https:\/\/i.ytimg.com\/vi\/1vwOFt9FBm4\/default.jpg\",\"https:\/\/i.ytimg.com\/vi\/1vwOFt9FBm4\/mqdefault.jpg\",\"https:\/\/i.ytimg.com\/vi\/1vwOFt9FBm4\/maxresdefault.jpg\"],\"uploadDate\":\"2019-04-16\",\"duration\":\"T00H29M33S\",\"embedUrl\":\"https:\/\/www.youtube.com\/embed\/1vwOFt9FBm4\"},{\"@context\":\"https:\/\/schema.org\",\"@type\":\"VideoObject\",\"name\":\"The glory of amp-script: Unleashing the kraken (AMP Conf '19)\",\"description\":\"AMP Documents traditionally have relied nearly exclusively on the well built large corpus of Web Components designed and validated to work within AMP. Today, we release the Kraken. We\u2019ll introduce `amp-script`, allowing custom JavaScript to operate within AMP Documents within reasonable limits. Custom logic can be expressed with the world\u2019s most popular programming language.\",\"thumbnailUrl\":[\"https:\/\/i.ytimg.com\/vi\/sYXkVOiz77I\/default.jpg\",\"https:\/\/i.ytimg.com\/vi\/sYXkVOiz77I\/mqdefault.jpg\",\"https:\/\/i.ytimg.com\/vi\/sYXkVOiz77I\/maxresdefault.jpg\"],\"uploadDate\":\"2019-04-16\",\"duration\":\"T00H30M05S\",\"embedUrl\":\"https:\/\/www.youtube.com\/embed\/sYXkVOiz77I\",\"about\":{\"@id\":\"https:\/\/www.suzukikenichi.com\/blog\/amp-script-component-gives-you-the-ability-to-run-javascript-from-within-an-amp-document\/\"}}]<\/script><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u72ec\u81ea\u306e JavaScript \u3092 AMP \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u306a\u304b\u3067\u5229\u7528\u53ef\u80fd\u306b\u3059\u308b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u516c\u958b\u3055\u308c\u305f\u3002&lt;amp-script&gt; \u3060\u3002\u30aa\u30ea\u30b8\u30f3 \u30c8\u30e9\u30a4\u30a2\u30eb\u306e\u53c2\u52a0\u8005\u3092\u73fe\u5728\u52df\u96c6\u4e2d\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1179],"tags":[1315,1391,1473,1474,1497],"class_list":["post-9928","post","type-post","status-publish","format-standard","category-mobile-seo","tag-amp-conf","tag-web-worker","tag-amp-conf-2019","tag-worker-dom","tag-amp-script"],"_links":{"self":[{"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/posts\/9928","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/comments?post=9928"}],"version-history":[{"count":0,"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/posts\/9928\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/media?parent=9928"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/categories?post=9928"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.suzukikenichi.com\/blog\/wp-json\/wp\/v2\/tags?post=9928"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}