BlueRain OS
  • Introduction
  • API
    • API Reference
  • Guides
    • Apps
      • Installation
      • Creating an App
      • Configuration
    • Components
      • Registering Components
      • Extending Components
      • Replacing Components
      • Accessing Raw Components
      • Components & HoCs
    • Filters
      • Known Filters
    • Plugins
      • Installation
      • Configuration
      • Creating a Plugin
  • Miscellaneous
    • JSON to React
  • Plugins
    • Apollo
    • Internationalization
    • Material UI
    • React Router
    • Redux
    • Redux Devtools
    • Why Did You Update
Powered by GitBook
On this page
  • Table of Contents
  • Platform
  • getType
  • setServerMode
  • filtersObj
  • BootOptions
  • boot
  • Config
  • ResponsiveLayout
  • onLayout
  • App
  • Plugin
  • IndexPage
  • NotFoundPage
  • WindowState
  • AppRegistry
  • register
  • set
  • registerMany
  • initializeAll
  • getComponentSchema
  • getAllRoutes
  • ComponentRegistry
  • register
  • set
  • addHocs
  • get
  • getRawComponent
  • replace
  • ConfigRegistry
  • set
  • get
  • register
  • registerMany
  • EventEmitter
  • FilterRegistry
  • add
  • set
  • remove
  • run
  • HookRegistry
  • add
  • run
  • Registry
  • set
  • replace
  • get
  • has
  • remove
  • PluginRegistry
  • register
  • set
  • registerMany
  • initializeAll
  1. API

API Reference

PreviousIntroductionNextApps

Last updated 6 years ago

Table of Contents

Platform

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

getType

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

  • Events EventRegistry Instance object of EventRegistry.

BootOptions

Options object that boot and bootOnServer methods expect.

Properties

  • config ConfigType Configuration object

  • config ConfigType?

boot

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

Parameters

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

  • 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.

Properties

  • size ("xs" | "sm" | "md" | "lg" | "xl") The window size i.e. (xs|sm|md|lg|xl)

  • size ("xs" | "sm" | "md" | "lg" | "xl")

AppRegistry

Extends MapRegistry

All system apps are stored in this registry

Properties

register

Register an App To be deprecated in 2.0.0

Parameters

set

Register an App

Parameters

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

getAllRoutes

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

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

  • rawComponent ReactElement<any> Interchangeable/extendable component.

set

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

Parameters

  • rawComponent ReactElement<any> Interchangeable/extendable component.

  • an empty array, and it's ok!

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

getRawComponent

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

Parameters

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

  • newComponent ReactElement<any>

  • rawComponent ReactElement<any> Interchangeable/extendable component.

ConfigRegistry

All system configs are stored in this registry

Properties

set

Set a Config

Parameters

  • value any

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

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

  • on which to run the filters

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

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

  • 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

Registry

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

Parameters

set

Add an item to the Registry.

Parameters

  • item any The item to add

replace

Replace an item in the Registry.

Parameters

  • item any The item to add

get

Get an item from the Registry by its key.

Parameters

Returns any

has

Check if an item is registered.

Parameters

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

set

Register a Plugin

Parameters

registerMany

Register many plugins at once

Parameters

initializeAll

Initialize all the registered plugins

Returns PlatformType ('web' | 'server' | 'ios' | 'android' | 'windows' | 'electron')

mode (optional, default false)

Apps Instance object of AppRegistry.

Components Instance object of ComponentRegistry.

Configs Instance object of ConfigRegistry.

Filters Instance object of FilterRegistry.

Plugins Instance object of PluginRegistry.

Utils Contains utility methods.

Utils.parseJsonSchema Converts JSON schema to React Component tree

refs Contains references of objects created by different apps and plugins

boot Function to boot the OS.

Type: {apps: <BR.App>?, config: ConfigType?, renderApp: ?, plugins: <BR.Plugin>?, serverMode: ?}

apps <BR.App> An array of apps to load

renderApp If set to false, BlueRain will not render the main app, instead it is up to the developer to render it. The App is returned from the boot function.

plugins <BR.Plugin> An array of plugins to load

serverMode Set this flag to true when rendering during Server Side Rendering

apps <BR.App>?

renderApp ?

plugins <BR.Plugin>?

serverMode ?

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

apps Configurations for apps

appRoutePrefix [default: "/app"] This route will be prependded to all app routes

debug [default: true, false if NODE_ENV="production"] Debug mode

development [default: true, false if NODE_ENV="production"] Development mode

locale [default: "en"] App locale

plugins Configurations for plugins

title [default: "BlueRain OS"] Main title of the app

theme Theme to customize styling

windowSize The window size i.e. (xs|sm|md|lg|xl)

appName Name of the app

slug App's slug, used in to build URL

category Category the App belongs to

description App description

version App version

appRoutePrefix Path that will be prepended before slug to build URL.

path Path of the app's home page

pluginName Name of the app

slug App's slug, used in to build URL

config Plugin configurations

category Category the App belongs to

description App description

version App version

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

width The window width

height The window height

width

height

data <, > Map(immutablejs) of all apps

app The BlueRain app to register

app The BlueRain app to register

apps <> The BlueRain apps to register

Returns JSON Schema

Returns JSON Schema

data <, {rawComponent: ReactElement<any>, hocs: <( | <any>)>}> Storage of all components

name The name of the component to register.

hocs <ComponentRegistryHocItem> The HOCs to compose with the raw component.

name The name of the component to register.

hocs <ComponentRegistryHocItem> The HOCs to compose with the raw component.Note: when a component is registered without higher order component, hocs will be

See

name The name of the registered component to whom hocs are to added

hocs <ComponentRegistryHocItem> The HOCs to compose with the raw component.

name The name of the component to get.

Returns ( | ReactElement<any>) A (wrapped) React component

name The name of the component to get.

Returns ( | ReactElement<any>) An interchangeable/extendable React component

name The name of the component to register.

newHocs ...<>

hocs ... The HOCs to compose with the raw component.

Returns ( | 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

ConfigsTable Storage table of all configs

key

key

All system events are stored in this registry.It is using to emit and add events.

data <, List<{name: , filter: }>> Storage of all filters and their respective functions

hook The name of the hook

name ( | ) The name of filter function

filter The filter function

index The index where function should be placed in array of functions against the hook

hook The name of the hook

name ( | ) The name of filter function

filter The filter function

index The index where function should be placed in array of functions against the hook

hook

name

hookName The name of the hook

filterName The name of the function to remove

hook First argument: the name of the hook

item Second argument: the post, comment, modifier, etc.

Returns Returns the item after it's been through all the filters for this hook

hook The name of the hook

name ( | )

filter The filter function

hook First argument: the name of the hook

Returns Returns the item after it's been through all the filters for this hook

name

key The key of the item

rest ...<any>

key The key of the item

key The key of the item

key

name The name of the item to check

Returns

key The key plugin to remove

rest ...<any>

data <, > Storage Map of all plugins

plugin The plugin to register

plugin The plugin to register

plugins <> The array of plugins to register

string
boolean
Object
Function
Object
Function
Array
boolean
Array
boolean
Array
boolean
Array
boolean
Array
boolean
Array
boolean
Object
string
boolean
boolean
string
Object
string
string
string
String
String
String
String
String
String
String
String
String
object
String
String
String
number
number
number
number
number
number
Object
Object
Map
string
Array
Function
Array
String
Array
String
Array
https://lodash.com/docs/4.17.4#flowRight
string
Array
String
Function
String
Function
String
Array
Function
Function
Function
https://lodash.com/docs/4.17.4#flowRight
Object
string
string
event emitter
Map
string
string
Function
String
String
function
Function
number
String
String
function
Function
number
string
string
string
string
String
Object
Object
String
string
Function
Function
String
Object
string
string
Array
string
string
string
string
boolean
string
Array
Platform
getType
setServerMode
filtersObj
BootOptions
boot
Config
ResponsiveLayout
onLayout
App
Plugin
IndexPage
NotFoundPage
WindowState
AppRegistry
register
set
registerMany
initializeAll
getComponentSchema
getAllRoutes
ComponentRegistry
register
set
addHocs
get
getRawComponent
replace
ConfigRegistry
set
get
register
registerMany
EventEmitter
FilterRegistry
add
set
remove
run
HookRegistry
add
run
Registry
set
replace
get
has
remove
PluginRegistry
register
set
registerMany
initializeAll
AppRegistry
ComponentRegistry
ConfigRegistry
FilterRegistry
PluginRegistry
BootOptions
Map
string
App
App
App
Array
App
Map
string
Plugin
Plugin
Plugin
Array
Plugin