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
define('meuModulo', ['lodash'], function(_) { | |
// código do módulo | |
return { | |
... | |
}; | |
}); | |
// os argumentos do módulo devem estar na mesma ordem do array de dependências | |
define('meuModulo', ['lodash', 'facebook'], function(_, fb) { | |
// código do módulo |
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
(function(global){ | |
const idade = 21; | |
const cpf = 13412312321; | |
function meuNomeQueSeraExposto() { | |
return 'Lucas'; | |
} | |
function meuNomeQueNaoSeraExposto() { | |
return 'Lucas Muniz Dutra'; | |
} |
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
/* | |
O UMD verifica se você está usando AMD ou CommonJS. | |
Caso você não esteja usando nenhum desses dois, ele | |
adiciona seu módulo no objeto global. | |
*/ | |
(function (global, factory) { | |
// verifica se é AMD | |
if (typeof define === "function" && define.amd) { | |
define(["exports"], factory); | |
// verifica se é CommonJS |
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
(function(namespace){ | |
'use strict'; | |
function getName() { | |
return 'Lucas'; | |
} | |
namespace.greeting = { | |
hi: function hi() { | |
console.log('hi ' + getName()); | |
}, |
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
var cokePkt = cokePkt || {}; | |
cokePkt.greeting = { | |
hi: function hi() { | |
console.log('hi'); | |
}, | |
hello: function hello() { | |
console.log('hello'); | |
} | |
}; |
NewerOlder