Files
nebula.js/docs/nucleus-reference.md
2020-03-20 13:21:20 +01:00

6.0 KiB

id, title
id title
nucleus-reference API Reference

Table of contents

API

interface: nucleus(app[, instanceConfig])

Initiates a new Nucleus instance using the specified app.

import nucleus from '@nebula.js/nucleus';
const n = nucleus(app);
n.render({ id: 'abc' });
  • createConfiguration <Function> Creates a new nucleus scope bound to the specified configuration.

The configuration is merged with all previous scopes.

interface: Context

interface: Configuration

class: Nucleus

nucleus.render(cfg)

Renders a supernova into an HTMLElement.

// render from existing object
n.render({
  element: el,
  id: 'abcdef',
});
// render on the fly
n.render({
  type: 'barchart',
  fields: ['Product', { qLibraryId: 'u378hn', type: 'measure' }],
});

nucleus.context(ctx)

Updates the current context of this nucleus instance. Use this when you want to change some part of the current context, like theme.

// change theme
n.context({ theme: 'dark' });
// limit constraints
n.context({ constraints: { active: true } });

nucleus.selections()

Gets the app selections of this instance.

const selections = await n.selections();
selections.mount(element);

interface: ThemeInfo

  • id <string> Theme identifier
  • load <Function> A function that should return a Promise that resolve to a raw JSON theme

class: SupernovaController

A controller to further modify a supernova after it has been rendered.

const ctl = await nucleus(app).render({
  element,
  type: 'barchart',
});
ctl.destroy();

supernovaController.destroy()

Destroys the supernova and removes if from the the DOM.

const ctl = ctl.destroy();

class: AppSelections

appSelections.mount(element)

  • element <HTMLElement>

Mounts the app selection UI into the provided HTMLElement

selections.mount(element);

appSelections.unmount()

Unmounts the app selection UI from the DOM

selections.unmount();

interface: CreateConfig

interface: BaseConfig

  • element <HTMLElement>
  • options <Object>

interface: GetConfig

type Field = <string|qae.NxDimension|qae.NxMeasure|LibraryField>

interface: LibraryField

  • qLibraryId <string>
  • type <dimension|measure>

interface: LoadType(type, env)

interface: TypeInfo