Sha256: 7b823d15da3f2bca6542707976a2355088c55fe8e0cee44412bea8e7c7dca90a

Contents?: true

Size: 924 Bytes

Versions: 2

Compression:

Stored size: 924 Bytes

Contents

define(['omf/data_source3'], function(data_source) {
  function data_source_repo() {
    console.log("Creating data source repo");
    var sources = {};

    function context() {};

    context.register = function(opts) {
      var id = opts.id || opts.name;
      if (sources[id] == null) {
        sources[id] = data_source(opts);
      }
      return context;
    };

    context.lookup = function(ds_descr) {
      var name;
      var dynamic = false;

      if (typeof(ds_descr) == 'object') {
        name = ds_descr.id || ds_descr.name;
        dynamic = ds_descr.dynamic;
      } else {
        name = ds_descr;
      }
      var source = sources[name];
      if (! source) {
        throw("Unknown data source '" + name + "'.");
      }
      if (dynamic) {
        source.is_dynamic(dynamic);
      }
      return source;
    };

    return context;
  }
  return data_source_repo(); // Create the singleton
});


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omf_web-1.2.1 share/htdocs/js/data_source_repo.js
omf_web-1.2.0 share/htdocs/js/data_source_repo.js