Helps to keep the promise that we only run ``get_datatable_options()`` once.
338082
def _get_datatable_options(self):
        
        if not hasattr(self, '_datatable_options'):
            self._datatable_options = self.get_datatable_options()

            # Convert sources from list to tuple, so that modern Column tracking dicts can hold the
            # field definitions as keys.
            columns = self._datatable_options.get('columns', [])
            for i, column in enumerate(columns):
                if len(column) >= 2 and isinstance(column[1], list):
                    column = list(column)
                    column[1] = tuple(column[1])
                    columns[i] = tuple(column)

        return self._datatable_options
182413
async function repeatablePromise (initialAssumptions, assumptionsFromResult, promiseGenerator) {
    let promise = promiseGenerator(initialAssumptions);
    let result = await promise;
    let finalAssumptions = assumptionsFromResult(result);
    if (JSON.stringify(initialAssumptions) === JSON.stringify(finalAssumptions)) {
        return promise;
    } else {
        return promiseGenerator(finalAssumptions);
    }
}
1022394
function(oSettings) {
      //trick to show row numbers
      for (var i = 0; i < oSettings.aiDisplay.length; i++) {
        $("td:eq(0)", oSettings.aoData[oSettings.aiDisplay[i]].nTr).html(i + 1);
      }

      //Hide pagination when we have a single page
      var activePaginateButton = false;
      $(oSettings.nTableWrapper).find(".paginate_button").each(function() {
        if ($(this).attr("class").indexOf("current") == -1 && $(this).attr("class").indexOf("disabled") == -1) {
          activePaginateButton = true;
        }
      });
      if (activePaginateButton) {
        $(oSettings.nTableWrapper).find(".dataTables_paginate").show();
      } else {
        $(oSettings.nTableWrapper).find(".dataTables_paginate").hide();
      }
    }
746703
function (data, keepDataFormat) {
            var self = this;
            if (!keepDataFormat) {
                data = [data];
            }
            return self.tpl(data, self.option);
        }
650534
function(td, options) {
      var expected = options.indexes.expected[options.sequenceIndex] !== null;
      var exists = options.dataIndex !== null;
      td.setAttribute('data-expected', expected === exists ? 'yes' : 'no');
    }
701773
private String getDataAgingFreq(TableDefinition tableDef) {
        if (Utils.isEmpty(tableDef.getOption(CommonDefs.OPT_AGING_FIELD))) {
            return null;
        }
        String dataAgingFreq = tableDef.getOption(CommonDefs.OPT_AGING_CHECK_FREQ);
        if (!Utils.isEmpty(dataAgingFreq)) {
            return dataAgingFreq;
        }
        return tableDef.getAppDef().getOption(CommonDefs.OPT_AGING_CHECK_FREQ);
    }
403774
function( option, value ) {
            var curr = this.data( dataName ).options || {},
                prev = $.extend( {}, curr );

            if ( typeof option === "string" && option[ 0 ] !== "_" ) {
                if ( value === undefined ) {
                    return curr[ option ];
                } else {
                    curr[ option ] = value;
                    updateOptions( this, prev, curr );

                    return this;
                }
            } else if ( $.isPlainObject( option ) ) {
                $.extend( curr, option );
                updateOptions( this, prev, curr );

                this.data( dataName ).options = curr;
            }

            return curr;
        }
1233718
def _callable_once(func):
    

    def once(*args, **kwargs):
        if not once.called:
            once.called = True
            return func(*args, **kwargs)

    once.called = False
    return once
42854
function once(eventName, handler, context, args) {
    this.on(eventName, handler, context, args, true);
}
379204
function fetchOptions(handler, data, board, callback) {
  if (_.isEmpty(data)) {
    return callback(null, data);
  }

  async.eachSeries(board.selects, (item, next) => {
    if (item.select) {
      return join(handler, data, item, board.type, next);
    }
    next();
  }, err => callback(err, data));
}
1302898
function flushDataToListener(dataListener, dataChanged) {
    try {
      if (dataListener) {
        const dataToForward = dataHandler.get(
          model[dataContainerName],
          dataListener.request,
          dataChanged
        );
        if (
          dataToForward &&
          (JSON.stringify(dataToForward) !== dataListener.request.lastPush ||
            dataListener.request.metadata.forceFlush)
        ) {
          dataListener.request.lastPush = JSON.stringify(dataToForward);
          dataListener.onDataReady(dataToForward);
        }
      }
    } catch (err) {
      console.log(`flush ${dataName} error caught:`, err);
    }
  }
94722
function Once(event) {
      return Component.createDecorator(function (componentOptions, k) {
          var key = hyphenate(k);
          if (typeof componentOptions.created !== 'function') {
              componentOptions.created = function () { };
          }
          var original = componentOptions.created;
          componentOptions.created = function () {
              original();
              if (typeof componentOptions.methods !== 'undefined') {
                  this.$once(event || key, componentOptions.methods[k]);
              }
          };
      });
  }
290140
def get_datatables(self, only=None):
        
        if not hasattr(self, '_datatables'):
            self._datatables = {}
            datatable_classes = self.get_datatable_classes()
            for name, datatable_class in datatable_classes.items():
                if only and name != only:
                    continue
                queryset_getter_name = 'get_%s_datatable_queryset' % (name,)
                queryset_getter = getattr(self, queryset_getter_name, None)
                if queryset_getter is None:
                    raise ValueError("%r must declare a method %r." % (self.__class__.__name__,
                                                                       queryset_getter_name))

                queryset = queryset_getter()
                if datatable_class is None:
                    class AutoMeta:
                        model = queryset.model
                    opts = AutoMeta()
                    datatable_class = Datatable
                else:
                    opts = datatable_class.options_class(datatable_class._meta)

                kwargs = self.get_default_datatable_kwargs(object_list=queryset)
                kwargs_getter_name = 'get_%s_datatable_kwargs' % (name,)
                kwargs_getter = getattr(self, kwargs_getter_name, None)
                if kwargs_getter:
                    kwargs = kwargs_getter(**kwargs)
                if 'url' in kwargs:
                    kwargs['url'] = kwargs['url'] + "?datatable=%s" % (name,)

                for meta_opt in opts.__dict__:
                    if meta_opt in kwargs:
                        setattr(opts, meta_opt, kwargs.pop(meta_opt))

                datatable_class = type('%s_Synthesized' % (datatable_class.__name__,), (datatable_class,), {
                    '__module__': datatable_class.__module__,
                    'Meta': opts,
                })

                self._datatables[name] = datatable_class(**kwargs)
        return self._datatables
863872
function(ev,args) {
      var target = Event.getTarget(ev);
      var column = this.datatable.getColumn(target);      
      var rowIndex = this.datatable.getTrIndex(target);
      if (column.key == 'delete') {
         if (confirm(msgs.confirmDeletion)) {
            var record = this.datatable.getRecord(target);
            if(this.editingNewRecord) {
               this.editingNewRecord = false;
            }
            else {
               this.itemRemovedEvt.fire( record );
            }
            this.datatable.deleteRow(target);
            this.hideSubform();
         }
      }
      else if(column.key == 'modify') {
         this.onClickModify(rowIndex);
      } 
      else {				
      	this.onCellClick(ev,rowIndex);
      }
   }
1167627
function redata(params, onUpdate) {
// console.log('redata()', params);
        // If should not reload the data.
        if (!shouldReload(params)) {
console.log('will not reload');
            // Inform any subscriber.
            onUpdate && onUpdate(ctx.lastData);

            // Resolve with last data.
            return Promise.resolve(ctx.lastData);
        }
console.log('will reload');
        // Data not valid, will load new data and subscribe to its updates.
        // Reset lastData, since it is no longer valid.
        ctx.lastData = { ...defaultInitialData };
// debugger;
        // Update any subscriber about new data.
        onUpdate && onUpdate(ctx.lastData);

        // Store promise reference in order to check which is the last one if multiple resolve.
        ctx.promise = load(ctx, loader, params, onUpdate);
// console.log('storing ctx promise', ctx.promise);
ctx.promise.loader = loader;
        return ctx.promise;
    }
790948
function (name, done) {
                    if (name && done) {
                        if (self.datatables[name]) {
                            done(self.datatables[name]);
                        } else {
                            throw new Error("not found datatable " + name);
                        }
                    }
                }
458178
function once(child) {
    if (handle(current) === true) {
      return
    }

    readdir(current, onread)

    function onread(error, entries) {
      var length = entries ? entries.length : 0
      var index = -1
      var entry

      if (error) {
        entries = []
      }

      while (++index < length) {
        entry = entries[index]

        if (entry !== child && handle(resolve(current, entry)) === true) {
          return
        }
      }

      child = current
      current = dirname(current)

      if (current === child) {
        callback(null, one ? null : results)
        return
      }

      once(basename(child))
    }
  }