Last active
August 29, 2015 14:14
-
-
Save albertoarena/ecf9c937a71ffac6d6dc to your computer and use it in GitHub Desktop.
Getter/Setter RequireJS module
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
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