Functions

forwardParams

This function inserts parameters into the route state and outputs a ready-made dynamic state.

Args:

/*
* Params interface describes an object which has string key
*/

(
  state: string[],
  params?: Params
)

Return Type:

string[]

Usage example:

const url = forwardParams(userUnit.user.state, { id: 15 };
this.router.navigate(url);

// or

this.router.navigate(forwardParams(userUnit.user.state, { id: 15 })

getRegisteredUnits

A function that returns all declared units in the application (hub)

Generic Type:

<T = any>

Args:

No args

Return Type:

Units<T>

Usage example:

export interface Hub {
  app: AppNote & AppChildNotes;
  about: AboutNotes;
  bikes: BikeNotes
}

export const hub: Units<Hub> = getRegisteredUnits<Hub>();

getUnit

A function that returns a unit by an identifier (key or name)

Generic Type:

<R = any, C = {}>

Args:

(
    arg: privateNotesKey
)

Return Type:

Unit<R, C>

Usage example:

const unit = getUnit<AppNotes>(APP_HUB_KEY);

connectFeatures

It connects feature-connector with parent routes.

Generic Type:

<R = any, C = {}>

Args:

(
   key: privateNotesKey,
   features: partialFeatureRoutes<R, C>
)

Return Type:

void

Usage example:

createRoot<AppNotes, AppChildNotes>(appRoutes, { key: APP_NOTES_KEY });

/**
* it will connect aboutConnector to 'about' path of appRoutes
*/
connectFeatures<AppNotes, AppChildNotes>(APP_NOTES_KEY, {
  about: aboutConnector
});

Last updated