Skip to content

Instantly share code, notes, and snippets.

@elisechant
Last active August 29, 2015 14:04
Show Gist options
  • Save elisechant/1bce0a8fd39bbf087600 to your computer and use it in GitHub Desktop.
Save elisechant/1bce0a8fd39bbf087600 to your computer and use it in GitHub Desktop.
JavaScript Factory Object
"use strict";
var Namespace = window.Namespace || {};
/**
* Factory for Modal Instances
* @param data {Object} - instance configurable props
* @constructor
*/
(function() {
Namespace.Modal = function(data) {
var _data = data || {};
// instance properties
this.width = _data.width || 600;
this.height = _data.height || 800;
};
Namespace.Modal.prototype = {
constructor: Namespace.Modal,
methodA: function() {
return [this.width, this.height].join(' ');
}
};
}());
// Constructor instances
var HomepageModal = new Namespace.Modal();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment