We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
once
1 parent a675700 commit 9b346edCopy full SHA for 9b346ed
cms/static/cms/js/modules/cms.base.js
@@ -522,12 +522,19 @@ var CMS = {
522
return root.trigger(_ns(eventName), [payload]);
523
},
524
525
+ /**
526
+ * Returns a function that wraps the passed function so the wrapped function
527
+ * is executed only once, no matter how many times the wrapper function is executed.
528
+ *
529
+ * @method once
530
+ * @param {Function} fn function to be executed only once
531
+ * @return {Function}
532
+ */
533
once: function once(fn) {
534
var result;
535
var didRunOnce = false;
536
537
return function () {
- console.log('running "once", did already run?', didRunOnce);
538
if (!didRunOnce) {
539
didRunOnce = true;
540
result = fn.apply(this, arguments);
0 commit comments