nomade-core

Nomade framework core services

Usage no npm install needed!

<script type="module">
  import nomadeCore from 'https://cdn.skypack.dev/nomade-core';
</script>

README

Nomade core Build Status

An extension containing core services.

Quick start

// registers extension
kernel.register(require('nomade-core'));

Common usage

All services provided by the core extension are based on the adapter pattern.

  • To always use a specific adapter:

    config = {
        'service-id': {
            adapter: 'adapter-id'
        }
    };
    
  • To route to an adapter using a function:

    config = {
        'service-id': {
            adapter: function (/* adapter specific parameters */) {
                // your logic here
                return 'adapter-id';
            }
        }
    };
    
  • If you don't specify any adapter, the default one will be used.

  • If you don't define any config for a service, a special noop adapter will be used.

  • If you specify a non existing adapter, the noop one will be used.

Provided services

  • translator: Translates string
    • trans(message, [locale], [params]): returns a string
    • choose(message, count, [locale], [params]): returns a string