This file contains 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
<div id="app"> | |
<button @click="disconnect" v-if="status === 'connected'">Disconnects </button> | |
<button @click="connect" v-if="status === 'disconnected'">Connect</button> {{ status }} | |
<br /><br /> | |
<div v-if="status === 'connected'"> | |
<form @submit.prevent="sendMessage" action="#"> | |
<input v-model="message"><button type="submit">Send Message</button> | |
</form> | |
<ul id="logs"> | |
<li v-for="log in logs" class="log"> |
This file contains 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
var context= new (window.AudioContext || window.webkitAudioContext)(); | |
var oscillator = context.createOscillator(); | |
oscillator.frequency.value = 5000; | |
oscillator.start(); | |
oscillator.connect(context.destination); | |
// Only be heard by those under 40 | |
// oscillator.frequency.value = 15000; | |
// Only be heard by those under 18 |
This file contains 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
// Calling the function using promises. | |
addElement("first promise sexy syntax") | |
.then(x => addElement("second promise syntax")) | |
.then(x => addElement("third promise syntax")) | |
.then(x => addElement("fourth promise syntax")) | |
// Calling the function using Async/Await | |
async function myFunction(){ | |
await addElement("first async"); | |
await addElement("second async"); |
This file contains 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
<link href="../core-icon-button/core-icon-button.html" rel="import"> | |
<link href="../core-toolbar/core-toolbar.html" rel="import"> | |
<link href="../core-header-panel/core-header-panel.html" rel="import"> | |
<link href="../topeka-elements/category-images.html" rel="import"> | |
<link href="../core-icon/core-icon.html" rel="import"> | |
<link href="../core-icons/core-icons.html" rel="import"> | |
<link href="../core-icons/av-icons.html" rel="import"> | |
<link href="../paper-fab/paper-fab.html" rel="import"> | |
<polymer-element name="my-element"> |
This file contains 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
window.onmousemove = function(e) {e.clientX}; | |
This file contains 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
interface Rapper { | |
say(x: string): void; | |
clear(): void; | |
speak(): string; | |
} | |
function makeRapper(): Rapper{ | |
var words; | |
return { | |
say: function (x: string){ |
This file contains 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
interface Thing { | |
a: number; | |
b: string; | |
foo: { | |
(x: string): string; | |
(x: number): number; | |
data: any; | |
}; | |
new (s: string): Element; | |
[index: number]: Date; |
This file contains 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
interface Thing { | |
a: number; | |
b: string; | |
foo: { | |
(x: string): string; | |
(x: number): number; | |
data: any; | |
}; | |
} |
This file contains 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
interface Thing { | |
a: number; | |
b: string; | |
foo(x: string): string; | |
foo(x: number): string; | |
} | |
function process(x: Thing){ | |
return x.foo(2) | |
} |
This file contains 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
interface Thing { | |
a: number; | |
b: string; | |
foo(x: string, n?: number): string; | |
} | |
function process(x: Thing){ | |
return x.foo("string"); | |
} |