Last active
August 29, 2015 14:19
-
-
Save ondrek/4d8be5e1265e8e3026f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function(){ | |
"use strict"; | |
// framework | |
window.$config = function(){ | |
var Config = function(){}; | |
var self = {}; | |
Config.prototype = { | |
set $set(val){ self[val] = "" }, | |
get $set(){ return self }, | |
get $get(){ return self } | |
}; | |
return new Config(); | |
}; | |
// dev | |
var config = $config(); | |
config.$set.REST_API = "/oauth/rest/v2/"; | |
config.$set.IS_DEVELOPMENT = true; | |
console.debug(config.$get.IS_DEVELOPMENT); // > true | |
console.debug(config.$get.REST_API); // > "/oauth/rest/v2/" | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mam takyto pattern,
chcem zachovat tuto "object-like syntax" (bez zatvoriek a cez bodku)
problem: nechcem, aby ked das
console.log(config.$set)
tak si sa dostal a attributom presne rovnako, ako cez$get
- aby to nahodou niekto negetol cez$set
.. nejaky napad? :)