This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="ja"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Document</title> | |
| <style> | |
| a {color: #3399FF;} | |
| a:hover {color: #FF6600;} | |
| </style> | |
| </head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "MSEdge browserAction sample", | |
| "author": "(Your name write down here.)", | |
| "version": "0.1", | |
| "manifest_version": 2, | |
| "description": "マイクロソフト Edge 拡張のサンプル(browserAction)", | |
| "browser_action": { | |
| "default_icon": { | |
| "19": "icon/e-19.png" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Edge の名前空間(browser) がなけれぱ chrome の名前空間を使用する | |
| var browser = browser||chrome; | |
| //コンテキストメニューに拡張のメニューを追加 | |
| browser.contextMenus.create({ | |
| id: 'menu_1st_extension', | |
| title: '"%s"を取得', //%s は選択している文字列で置き換わる | |
| contexts: ['selection'], //選択しているときのみメニューに表示される | |
| onclick: (info, tab)=>{ //クリックされた際のアクション | |
| alert(info.selectionText); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "はじめての拡張", | |
| "author": "(Your name write down here.)", | |
| "version": "0.1", | |
| "description": "選択された文字を返しますよ", | |
| "background": { | |
| "scripts": ["background.js"], | |
| "persistent": true | |
| }, | |
| "permissions": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Generator を呼び出す | |
| var gen = stepper(); | |
| //Promise を使用して Generator の next メソッドを実行する | |
| gen.next().value.then(()=>{ | |
| return gen.next().value; | |
| }).then(()=>{ | |
| return gen.next().value; | |
| }); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //generator と yield を使用した非同期制御 | |
| var gen = stepper(); | |
| gen.next() | |
| //関数 stepper を generator として宣言 | |
| function *stepper(){ | |
| yield setTimeout(()=>{ | |
| echo_arg('A'); | |
| //生成された iterator の next メソッドをイベントハンドラ内で実行し次の処理に遷移させる | |
| gen.next(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //非同期実行のためコードの順番ではなく、 | |
| //コンソールには C, B, A の順番で出力される | |
| setTimeout('echo_arg("A")',3000); | |
| setTimeout('echo_arg("B")',2000); | |
| setTimeout('echo_arg("C")',1000); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html><head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| <title>NFC Divice detect sample</title> | |
| <script> | |
| window.onload = function () { | |
| var status = document.getElementById('status'); | |
| //Windows Runtime が検出されたら | |
| if (typeof Windows !=='undefined') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="ja" xmlns="http://www.w3.org/1999/xhtml"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
| <title></title> | |
| <style> | |
| option { | |
| font-size: 20px; | |
| } | |
| select { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="ja" xmlns="http://www.w3.org/1999/xhtml"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
| <title>HTML5 Gamepad API Sample</title> | |
| <script> | |
| var displayDiv = null; | |
| //ゲームパッドと操作の検出 |