API Reference

Table of Contents

Platform

This interface provides information about the OS or runtime platform on which the app is running.

getType

Returns stringarrow-up-right PlatformType ('web' | 'server' | 'ios' | 'android' | 'windows' | 'electron')

setServerMode

Set the Platform to 'server'. Useful to see if the app is rendering on server due to SSR.

Parameters

filtersObj

This is the main BlueRain context. Works as a backbone of whole system.

Properties

BootOptions

Options object that boot and bootOnServer methods expect.

Type: {apps: Arrayarrow-up-right<BR.App>?, config: ConfigType?, renderApp: booleanarrow-up-right?, plugins: Arrayarrow-up-right<BR.Plugin>?, serverMode: booleanarrow-up-right?}

Properties

boot

Boots the OS and renders the main UI. Use it on the client side

Parameters

  • options BootOptions (optional, default {serverMode:false,renderApp:true})

Returns ComponentType<any>

Config

This is the default configuration set that is used at boot time.

Type: ConfigType

Properties

ResponsiveLayout

ResponsiveLayout component to create responsive layouts.

Parameters

  • props ResponsiveLayoutProps

Properties

  • windowSize stringarrow-up-right The window size i.e. (xs|sm|md|lg|xl)

  • default React.Component The default component to render, if a current size component is not given.

  • xs React.Component The component to render when the screen size is extra-small.

  • sm React.Component The component to render when the screen size is small.

  • md React.Component The component to render when the screen size is medium.

  • lg React.Component The component to render when the screen size is large.

  • xl React.Component The component to render when the screen size is extra-large.

onLayout

Whenever the screen/window size changes, notify redux to update state.bluerain.window object.

App

Extends RX.Component

A BlueRain App base class

Properties

Plugin

Base class of a plugin which is to be extended.

Properties

IndexPage

Returns the Index Page layout.

Returns React.Component The layout react component

NotFoundPage

Returns the 404 Page layout.

Returns React.Component The layout react component

WindowState

The state of current window or screen. Stored in bluerain.window in the redux store.

Type: {width: numberarrow-up-right, height: numberarrow-up-right, size: ("xs" | "sm" | "md" | "lg" | "xl")}

Properties

AppRegistry

Extends MapRegistry

All system apps are stored in this registry

Properties

register

Register an App To be deprecated in 2.0.0

Parameters

  • app App The BlueRain app to register

set

Register an App

Parameters

  • app App The BlueRain app to register

registerMany

Register many apps at once

Parameters

initializeAll

Initialize all the registered apps

getComponentSchema

Returns the JSON schema of the main APPs component. This component renders all the routes of apps.To be deprecated in 2.0.0

Returns Objectarrow-up-right JSON Schema

getAllRoutes

Returns the JSON schema of the main APPs component. This component renders all the routes of apps.

Returns Objectarrow-up-right JSON Schema

ComponentRegistry

Extends MapRegistry

All system components are stored in this registry

Properties

register

Register a component with a name, a raw component than can be extended and one or more optional higher order components.To be deprecated in 2.0.0

Parameters

  • name Stringarrow-up-right The name of the component to register.

  • rawComponent ReactElement<any> Interchangeable/extendable component.

  • hocs Arrayarrow-up-right<ComponentRegistryHocItem> The HOCs to compose with the raw component.

set

Register a component with a name, a raw component than can be extended and one or more optional higher order components.

Parameters

addHocs

Adds higher order component to the registered component

Parameters

get

Get a component registered with set(name, component, ...hocs). Its accepts multiple component names.It iterates arguments and returns first found registered component.

Parameters

Returns (Functionarrow-up-right | ReactElement<any>) A (wrapped) React component

getRawComponent

Get the raw (original) component registered with registerComponent without the possible HOCs wrapping it.

Parameters

Returns (Functionarrow-up-right | ReactElement<any>) An interchangeable/extendable React component

replace

Replace a component with the same name with a new component or an extension of the raw component and one or more optional higher order components. This function keeps track of the previous HOCs and wrap the new HOCs around previous ones

Parameters

Returns (Functionarrow-up-right | ReactElement<any>) A component callable with Components[name]Note: when a component is registered without higher order component, hocs will be an empty array, and it's ok! See https://lodash.com/docs/4.17.4#flowRightarrow-up-right

ConfigRegistry

All system configs are stored in this registry

Properties

set

Set a Config

Parameters

get

Get a config value

Parameters

Returns any

register

Register a Config To be deprecated in 2.0.0

Parameters

  • configs {}

registerMany

Register many configs at once

Parameters

  • configs {}

EventEmitter

All system events are stored in this registry.It is using event emitterarrow-up-right to emit and add events.

FilterRegistry

Extends MapRegistry

All system filters are stored in this registry

Properties

add

Add a filter function to a hook.To be deprecated in 2.0.0

Parameters

set

Add a filter function to a hook.

Parameters

remove

Remove a filter from a hook

Parameters

run

Successively run all of a hook's filters on an item

Parameters

  • hook Stringarrow-up-right First argument: the name of the hook

  • item Objectarrow-up-right Second argument: the post, comment, modifier, etc.

    on which to run the filters

  • args Any Other arguments will be passed to each successive iteration

Returns Objectarrow-up-right Returns the item after it's been through all the filters for this hook

HookRegistry

All system hooks are stored in this registry

Parameters

  • filters

  • events

add

Add a filter function to a hook.

Parameters

run

Successively run all of a hook's functions on an item

Parameters

  • hook Stringarrow-up-right First argument: the name of the hook

  • mode ("async" | "sync" | "both") Second argument: mode in which hook will run. If not given mode will be sync (optional, default 'sync')

  • args Any Other arguments will be passed to each successive iteration

Returns Objectarrow-up-right Returns the item after it's been through all the filters for this hook

Registry

A generic Registry class in the BlueRain OS. Used to store data.

Parameters

set

Add an item to the Registry.

Parameters

replace

Replace an item in the Registry.

Parameters

get

Get an item from the Registry by its key.

Parameters

Returns any

has

Check if an item is registered.

Parameters

Returns booleanarrow-up-right

remove

Remove a plugin from the registry

Parameters

PluginRegistry

Extends MapRegistry

All system plugins are stored in this registry

Properties

register

Register a Plugin To be deprecated in 2.0.0

Parameters

  • plugin Plugin The plugin to register

set

Register a Plugin

Parameters

  • plugin Plugin The plugin to register

registerMany

Register many plugins at once

Parameters

initializeAll

Initialize all the registered plugins

Last updated