JavaScript - Crocford
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
(function() { | |
let chatModule = (function() { | |
let message = 'hi bro' | |
function say() { | |
console.log(message); | |
} | |
return { | |
say: say |
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
let observerDecorator = (function () { | |
let eventList = {} | |
return function (obj) { | |
obj.addEvent = (event, fn) => { | |
if(!eventList[event]) { | |
eventList[event] = [] | |
} | |
if(eventList[event].indexOf(fn) === -1) { |
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
//Function composition | |
function Animal(name) { | |
let publicAPI = { | |
say: function() { | |
console.log(`I am ${name}`); | |
} | |
} | |
return publicAPI | |
} |
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
//Prototype Pattern | |
function Animal(name) { | |
this.name = name | |
} | |
Animal.prototype.say = function() { | |
console.log(`I am ${this.name}`) | |
} | |
function Rabbit(name) { |
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
//Function inheritance | |
function Animal(name) { | |
this.name = name | |
this.say = function() { | |
console.log(`I am ${this.name}`) | |
} | |
} | |
function Rabbit(name) { |
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
//OLOO - delegated objects | |
var Animal = { | |
init: function(name) { | |
this.name = name | |
}, | |
say: function() { | |
console.log(`I am ${this.name}`) | |
} | |
} |
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
Per https://code.google.com/p/v8/codesearch#v8/trunk/src/runtime.cc | |
%CreateSymbol | |
%CreatePrivateSymbol | |
%CreateGlobalPrivateSymbol | |
%NewSymbolWrapper | |
%SymbolDescription | |
%SymbolRegistry | |
%SymbolIsPrivate |
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
save-exact=true |
Base URL: http://translate.google.com/translate_tts
It converts written words into audio. It accepts GET
requests.
q
The query string to convert to audio
tl
Translation language, for example, ar
for Arabic, or en-us
for English
OlderNewer