Skip to content

Instantly share code, notes, and snippets.

@frentsel
Created August 5, 2015 07:51
Show Gist options
  • Save frentsel/5396cf02eb9e3fa0b401 to your computer and use it in GitHub Desktop.
Save frentsel/5396cf02eb9e3fa0b401 to your computer and use it in GitHub Desktop.
Simple example of pattern "module" with import of extentions
var $scope = (function($){
var _this = {
name: 'Alex'
};
return {
get: function(prop){
return _this[prop];
},
set: function(prop, val){
return _this[prop] = val;
}
};
})(jQuery);
$scope._this; // undefined
$scope.get("name"); // "Alex"
$scope.set("name", "Sanya");
$scope.get("name"); // "Sanya"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment