senecajs/seneca

Shared object not available in preload function

vitorclelis96 opened this issue · 0 comments

In the preload function, the shared object ins't created yet.
Example:

async function preload(seneca) {
  // seneca.shared is null
  seneca.shared = {}; // Need to manually boot seneca shared

  // Now you can use the seneca.shared instance here
  seneca.shared.x = 10;
  // shared.x will be available outside
}

Fix:
Instead of manually creating seneca.shared = {}, the seneca instance should be available already in preload function.