Module

start

This module contains functions for starting JS on the browser side

import * from "@quintype/framework/client/start";

View Source client/start.js, line 1

Members

static constant app

app contains multiple useful functions for controlling the app. These are saved on global.app.

View Source client/start.js, line 36

static constant history

The history object can be used to manipulate browser history.

View Source client/start.js, line 30

Methods

static maybeNavigateTo(path, store) → {void}

Navigate to the page if it is not the current page as per redux. This internally calls navigateToPage

This function can also be called as app.maybeNavigateTo().

Parameters:
Name Type Description
path string

The new path

store Redux

The redux store

View Source client/start.js, line 126

void

static maybeSetUrl(path, title) → {void}

Sets the url and title

  • This function can also be called as app.maybeSetUrl().
Parameters:
Name Type Description
path string

The new path

title string

The new title.

View Source client/start.js, line 139

void

static navigateToPage(dispatch, path, doNotPushPath) → {void}

navigateToPage is called when hydrating the initial page, or moving between pages with AJAX. You may want to consider calling maybeNavigateTo instead.

This function can also be called as app.navigateToPage().

Parameters:
Name Type Description
dispatch function

The dispatch of the story

path string

The new path you are jumping to

doNotPushPath boolean

If set to true, then the path is not appended to pushState

View Source client/start.js, line 81

void

static renderBreakingNews(container, store, view, props)

Parameters:
Name Type Description
container string

The id of the container to render the given component

store Redux

The redux store

view *

The view to be rendered

props Object

Properties to bootstrap the component with

View Source client/start.js, line 191

static renderComponent(clazz, container, store, props, callback)

renderComponent can be used to render a component given the component, container and a redux store.

Parameters:
Name Type Description
clazz Component

The component to render

container string

The id of the container to render the given component

store Redux

The redux store

props Object

Properties to bootstrap the component with

hydrate boolean

Hydrate the component instead of rendering it

callback callback

Callback on completion

View Source client/start.js, line 155

static renderIsomorphicComponent(container, store, pickComponent, props)

renderIsomorphicComponent can be used to render a component given the container and a redux store. This uses IsomorphicComponent internally.

Parameters:
Name Type Description
container string

The id of the container to render the given component

store Redux

The redux store

pickComponent function

The pickComponent function

props Object

Properties to bootstrap the component with

hydrate boolean

Hydrate the component instead of rendering it

View Source client/start.js, line 174

static startApp(renderApplication, reducers, opts) → {Redux}

Start the Browser Application. This is the entry point for the Quintype framework

Parameters:
Name Type Description
renderApplication function

Once the data is fetched, renderApplication(store) will be called to render all components on page. See renderApplication

reducers Object

A list of custom reducers for your application. This will be merged with the built in reducers

opts Object

Options

preRenderApplication function

Render a part of the application on boot. See preRenderApplication

enableFCM boolean

Enable Firebase Cloud Messaging for push notifications

enableServiceWorker boolean

Should service worker be enabled

serviceWorkerLocation string

Location of the service worker (default: /service-worker.js)

appVersion number

App Version. See Updating App Version

View Source client/start.js, line 222

The store that was created

Redux