|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
354 bytes
|
| Line | |
|---|
| 1 | define(function () {
|
|---|
| 2 |
|
|---|
| 3 | // Returns a function that will only be executed up to (but not including) the
|
|---|
| 4 | // Nth call.
|
|---|
| 5 | function before(times, func) {
|
|---|
| 6 | var memo;
|
|---|
| 7 | return function() {
|
|---|
| 8 | if (--times > 0) {
|
|---|
| 9 | memo = func.apply(this, arguments);
|
|---|
| 10 | }
|
|---|
| 11 | if (times <= 1) func = null;
|
|---|
| 12 | return memo;
|
|---|
| 13 | };
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | return before;
|
|---|
| 17 |
|
|---|
| 18 | });
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.