<commit_before>## API

this is used to populate the listed singleton plugins with their single instance

other plugins may access this instance through requiring the module.

### Example

```coffeescript
require ["pluginPath"], (plugin) -> plugin.getInstance().foo()`
```

### Example Usage

Now in your `main` coffeescript file, you can do something like this.

```coffeescript
requirejs ["celestrium"], (Celestrium) ->
  Celestrium.init
    "core/workspace":
      "el": document.querySelector "#workspace"
```

only plugins which instantiate the `singleton` class should be used with `init`

## Code

    define [], () -> init: (singletonPlugins, callback) ->
      pluginPaths = _.keys(singletonPlugins)
      require pluginPaths, (plugins...) ->
        i = 0
        for plugin in plugins
          args = singletonPlugins[pluginPaths[i]]
          plugin.init args
          i += 1
        callback()<commit_msg>move loading of global libraries into celestrium<commit_after>## API

this is used to populate the listed singleton plugins with their single instance

other plugins may access this instance through requiring the module.

### Example

```coffeescript
require ["pluginPath"], (plugin) -> plugin.getInstance().foo()`
```

### Example Usage

Now in your `main` coffeescript file, you can do something like this.

```coffeescript
requirejs ["celestrium"], (Celestrium) ->
  Celestrium.init
    "core/workspace":
      "el": document.querySelector "#workspace"
```

only plugins which instantiate the `singleton` class should be used with `init`

## Code

Load the global libraries contained within celestrium here.
This offloads this responsibility from the user.

    globalLibs = [
      'lib/jquery',
      'lib/jquery.typeahead',
      'lib/underscore',
      'lib/backbone',
      'lib/d3',
    ]

The actual module returns only an object with an init method.

    define [], () -> init: (singletonPlugins, callback) ->

Include this nested require call so as to load the above libraries.
Now, these libraries are available globally per the norm.

This is probably bad practice and less modular, but is practical.

      require globalLibs, () ->

Now actually require the different plugins.
Note that, they should all be required at once and the callback called within the require callback so as to ensure the callback is only call onced these plugin instances have been initialized.

        pluginPaths = _.keys(singletonPlugins)
        require pluginPaths, (plugins...) ->
          i = 0
          for plugin in plugins
            args = singletonPlugins[pluginPaths[i]]
            plugin.init args
            i += 1
          callback()
{'fraction_non_alphanumeric': 0.09527381845461365, 'fraction_numerical': 0.0018754688672168042, 'mean_word_length': 3.2603833865814695, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1342060', 'n_tokens_mistral': 719, 'n_tokens_neox': 692, 'n_words': 288}