Skip to content

Instantly share code, notes, and snippets.

@Pickachu
Last active October 5, 2015 00:08
Show Gist options
  • Save Pickachu/2720897 to your computer and use it in GitHub Desktop.
Save Pickachu/2720897 to your computer and use it in GitHub Desktop.
Javascript Prototypal Programming
var controller = (function controller_declaration(library, library...) {
// Namespace de elementos com regras de negócio
var ... = {...}
// Controller da página em questao
var controller = {...}
// Roteador de ações efetuadas na página, geralmente para o controller
var router = {...}
function initialize() { // controller initialization }
$(initialize)
}).call(parent_container, library, library...);
module.mixin = (function mixin_declaration(library, library...) {
var mix = other_mixin();
// Mix specific functions
function ... () {...};
// Aditional shared function
mix[...] = function ... () {...};
return mix;
}).call(parent_container, library, library...);
var module = (function module_declaration(library, library...) {
var public = function utility_function() {return public;};
// Module specific namespaces
var ... = {...};
// Module public accessible methods
public[...] = function ... () {...};
// Module initialization
function initialize() {...};
$(initialize)
return public;
}).call(parent_container, library, library...);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment