Skip to content

Instantly share code, notes, and snippets.

@fraaalk
Created May 18, 2017 13:08
Show Gist options
  • Select an option

  • Save fraaalk/21d12dba1c8d743ec78aeaad48f78e9c to your computer and use it in GitHub Desktop.

Select an option

Save fraaalk/21d12dba1c8d743ec78aeaad48f78e9c to your computer and use it in GitHub Desktop.
const moduleFactory = function moduleFactoryFn(moduleName = '') {
const module = function moduleConstructor(element = null, options = {}) {
// call init function of module
this.init();
}
module.prototype.baseFunctionality1() {
};
module.prototype.baseFunctionality2() {
};
return module;
}
module.exports = moduleFactory;
const Modal = require('./../../components/modal/modal.js');
const Movie = require('./../../components/base-component/base-component.js')('movie');
Movie.prototype.init = function init() {
// stuff
}
Movie.prototype.showModal = function showModal($elem) {
const modal = new Modal($elem, {
foo: 'bar'
});
}
module.exports = Movie;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment