API Reference
Last updated
Last updated
This interface provides information about the OS or runtime platform on which the app is running.
Set the Platform to 'server'. Useful to see if the app is rendering on server due to SSR.
Parameters
This is the main BlueRain context. Works as a backbone of whole system.
Properties
Events
EventRegistry Instance object of EventRegistry.
Options object that boot
and bootOnServer
methods expect.
Properties
config
ConfigType Configuration object
config
ConfigType?
Boots the OS and renders the main UI. Use it on the client side
Parameters
Returns ComponentType<any>
This is the default configuration set that is used at boot time.
Type: ConfigType
Properties
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.
Whenever the screen/window size changes, notify redux to update state.bluerain.window
object.
Extends RX.Component
A BlueRain App base class
Properties
Base class of a plugin which is to be extended.
Properties
Returns the Index Page layout.
Returns React.Component The layout react component
Returns the 404 Page layout.
Returns React.Component The layout react component
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"
)
Extends MapRegistry
All system apps are stored in this registry
Properties
Register an App To be deprecated in 2.0.0
Parameters
Register an App
Parameters
Register many apps at once
Parameters
Initialize all the registered apps
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 the JSON schema of the main APPs component. This component renders all the routes of apps.
Extends MapRegistry
All system components are stored in this registry
Properties
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.
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!
Adds higher order component to the registered component
Parameters
Get a component registered with set(name, component, ...hocs). Its accepts multiple component names.It iterates arguments and returns first found registered component.
Parameters
Get the raw (original) component registered with registerComponent without the possible HOCs wrapping it.
Parameters
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.
All system configs are stored in this registry
Properties
Set a Config
Parameters
value
any
Get a config value
Parameters
Returns any
Register a Config To be deprecated in 2.0.0
Parameters
configs
{}
Register many configs at once
Parameters
configs
{}
Extends MapRegistry
All system filters are stored in this registry
Properties
Add a filter function to a hook.To be deprecated in 2.0.0
Parameters
Add a filter function to a hook.
Parameters
Remove a filter from a hook
Parameters
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
All system hooks are stored in this registry
Parameters
filters
events
Add a filter function to a hook.
Parameters
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
A generic Registry class in the BlueRain OS. Used to store data.
Parameters
Add an item to the Registry.
Parameters
item
any The item to add
Replace an item in the Registry.
Parameters
item
any The item to add
Get an item from the Registry by its key.
Parameters
Returns any
Check if an item is registered.
Parameters
Remove a plugin from the registry
Parameters
Extends MapRegistry
All system plugins are stored in this registry
Properties
Register a Plugin To be deprecated in 2.0.0
Parameters
Register a Plugin
Parameters
Register many plugins at once
Parameters
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