Skip to content

Instantly share code, notes, and snippets.

@cmalven
Last active October 13, 2015 07:07
Show Gist options
  • Select an option

  • Save cmalven/4157659 to your computer and use it in GitHub Desktop.

Select an option

Save cmalven/4157659 to your computer and use it in GitHub Desktop.

Revisions

  1. cmalven revised this gist May 22, 2014. 1 changed file with 37 additions and 35 deletions.
    72 changes: 37 additions & 35 deletions basic-js-object.js
    Original file line number Diff line number Diff line change
    @@ -1,55 +1,57 @@
    function MyObject(options) {


    /*****************************************
    /* PRIVATE VARS
    /****************************************/
    /*****************************************
    /* PRIVATE VARS
    /****************************************/

    var self = {}
    var self = {

    }

    /*****************************************
    /* PUBLIC VARS
    /****************************************/

    self.defaults = {
    /*****************************************
    /* PUBLIC VARS
    /****************************************/

    }
    self.defaults = {

    }

    /*****************************************
    /* PRIVATE METHODS
    /****************************************/

    var init = function() {
    updateSettings();
    addEventListeners();
    }
    /*****************************************
    /* PRIVATE METHODS
    /****************************************/

    var updateSettings = function() {
    if (typeof options == 'object') {
    self.settings = $.extend(self.defaults, options);
    } else {
    self.settings = self.defaults;
    }
    }
    var init = function() {
    updateSettings();
    addEventListeners();
    }

    var addEventListeners = function() {

    }
    var updateSettings = function() {
    if (typeof options == 'object') {
    self.settings = $.extend(self.defaults, options);
    } else {
    self.settings = self.defaults;
    }
    }

    var addEventListeners = function() {

    }

    /*****************************************
    /* PUBLIC METHODS
    /****************************************/

    self.myFunction = function() {
    /*****************************************
    /* PUBLIC METHODS
    /****************************************/

    }
    self.myFunction = function() {

    // Initiate
    init();
    }

    // Return the Object
    return self;
    // Initiate
    init();

    // Return the Object
    return self;
    }
  2. cmalven revised this gist Jun 27, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion basic-js-object.js
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ function MyObject(options) {

    self.defaults = {

    };
    }


    /*****************************************
  3. cmalven renamed this gist Jun 27, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. cmalven created this gist Nov 27, 2012.
    55 changes: 55 additions & 0 deletions basic-ms-object.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,55 @@
    function MyObject(options) {


    /*****************************************
    /* PRIVATE VARS
    /****************************************/

    var self = {}


    /*****************************************
    /* PUBLIC VARS
    /****************************************/

    self.defaults = {

    };


    /*****************************************
    /* PRIVATE METHODS
    /****************************************/

    var init = function() {
    updateSettings();
    addEventListeners();
    }

    var updateSettings = function() {
    if (typeof options == 'object') {
    self.settings = $.extend(self.defaults, options);
    } else {
    self.settings = self.defaults;
    }
    }

    var addEventListeners = function() {

    }


    /*****************************************
    /* PUBLIC METHODS
    /****************************************/

    self.myFunction = function() {

    }

    // Initiate
    init();

    // Return the Object
    return self;
    }