From 065dcbb27ba35e56f6d32529aacd4772468f178c Mon Sep 17 00:00:00 2001
From: Jeremy Ashkenas
@@ -738,6 +738,21 @@ $(window).scroll(throttled);
var lazyLayout = _.debounce(calculateLayout, 300); $(window).resize(lazyLayout); ++ +
+ once_.once(function)
+
+ Creates a version of the function that can only be called one time.
+ Repeated calls to the modified function will have no effect, returning
+ the value from the original call. Useful for initialization functions,
+ instead of having to set a boolean flag and then check it later.
+
+var initialize = _.once(createApplication); +initialize(); +initialize(); +// Application is only created once.