Skip to content

Instantly share code, notes, and snippets.

@albertoarena
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albertoarena/ecf9c937a71ffac6d6dc to your computer and use it in GitHub Desktop.
Save albertoarena/ecf9c937a71ffac6d6dc to your computer and use it in GitHub Desktop.
Getter/Setter RequireJS module
define([], function () {
return function(initValue, callback) {
var val = initValue;
if (typeof callback != 'function') {
callback = null;
}
return function (v) {
if (v !== undefined) {
val = v;
if (callback) {
callback(v);
}
}
return val;
};
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment