Index

utils/src/access-object.ts

access
access(value: Record, path: string)
Parameters:
Name Type Optional
value Record No
path string No
accessArrayProperty
accessArrayProperty(value, arrayPath: string)
Parameters:
Name Type Optional
value No
arrayPath string No
isArrayIndexer
isArrayIndexer(path: string)
Parameters:
Name Type Optional
path string No
Returns: boolean

router-x/navigation/src/lib/navigation-x.providers.ts

attemptToProduceAutoNavigationFunctionFor
attemptToProduceAutoNavigationFunctionFor(router: Router, composer?: RouteComposer)
Parameters:
Name Type Optional
router Router No
composer RouteComposer Yes
Returns: | undefined
createNavigationXFactoryProvider
createNavigationXFactoryProvider(route)
Parameters:
Name Optional
route No
Returns: FactoryProvider
provideNavigatorsFor
provideNavigatorsFor(...routes: undefined)
Parameters:
Name Optional
routes No
Returns: FactoryProvider[]
provideRouterX
provideRouterX(routes, ...features: NoHead)

Wraps Angular's provideRouter function and adds providers for the navigation-x module.

Parameters:
Name Type Optional Description
routes No

The Angular routes config tree to initialize navigation-x for.

features NoHead No

Addtional features to pass into Angular's provideRouter function.

Returns: Provider[]

The providers returned by provideRouter, along with other providers needed for navigation-x to work.

provideRoutesX
provideRoutesX(...routes: undefined)

Wraps Angular's provideRoutes function and adds providers for the navigation-x module.

Parameters:
Name Optional Description
routes No

The Angular routes config tree to initialize navigation-x for.

Returns: Provider[]

The providers returned by provideRoutes, along with other providers needed for navigation-x to work.

core/src/rxjs/on-observer/utils/time-utils.ts

breakdownTime
breakdownTime(showingForMs: number)
Parameters:
Name Type Optional
showingForMs number No
durationToMs
durationToMs(duration: DurationAnnotation)
Parameters:
Name Type Optional
duration DurationAnnotation No
Returns: number

router-x/navigation/src/lib/route-composer/_utils.ts

collectArrayRouteComposersByAutoNavigatioName
collectArrayRouteComposersByAutoNavigatioName(routes)
Parameters:
Name Optional
routes No
collectRouteComposersByAutoNavigatorName
collectRouteComposersByAutoNavigatorName(route)
Parameters:
Name Optional
route No
extractArgsFromPath
extractArgsFromPath(path: Path)
Parameters:
Name Type Optional
path Path No
Returns: RouteArgument[]

router-x/testing/src/utils/setup.ts

createDeeplyNestedRoutes
createDeeplyNestedRoutes(segments)

Recoursively creates nested routes for the specified segments. Each specified segment will be a child route of its previous segment.

Example

Running the function on ['some', 'route'] will result in the following supported routes:
/

/some
/some/route

Parameters:
Name Optional Description
segments No

The route segments from which routes are to be created.

Returns: Route

An Angular router module compatible route tree containing all segments as child routes.

language/testing/src/utils/setup.ts

createLocalizedDeeplyNestedRoutes
createLocalizedDeeplyNestedRoutes(segments)

Recoursively creates nested routes for the specified segments. Each specified segment will be a child route of its previous segment. Each created route will support 2 paths:

  1. The segment name.
  2. An 'en' path.

Example

Running the function on ['some', 'route'] will result in the following supported routes:
/

/some
/some/route

/en/
/en/some
/en/some/route

/some/en
/some/en/route

/some/route/en

Parameters:
Name Optional
segments No
Returns: Route
isUrlLocalizationConfig
isUrlLocalizationConfig(value: any)

Checks whether the given value is a url localization config object.

Parameters:
Name Type Optional Description
value any No

The value to test.

true if the value is a UrlLocalizationConfig object; otherwise false.

localizeRoute
localizeRoute(route: Route)

Recoursively adds an 'en' segment to all routes in the tree.

Parameters:
Name Type Optional Description
route Route No

The top most route to localize.

Returns: void
setupUrlLocalizerTest
setupUrlLocalizerTest(strategyOrConfig?)

Configures the testing module with localized routes for testing and language integration services. Routes are created by running createDeeplyNestedRoutes(DeepRouteSegments). Language integration tools are read from LanguageConfig.

The function extracts services from the testbed and returns them in the returned object for quick deconstruction.

Parameters:
Name Optional Description
strategyOrConfig Yes

The url localization strategy or full config.

router-x/utils/src/lib/use-route-deep-scan.ts

deepScanRoute
deepScanRoute(componentBus, route: ActivatedRouteSnapshot, process: RouteProcessFunction, levels: number)

Recoursively runs a processing function on the route and its children. Scan is done from parent to child, meaning the parent is the first to process.

Parameters:
Name Type Optional Default value Description
componentBus No

The instance of the component bus.

route ActivatedRouteSnapshot No

The top route on which to apply the processing function.

process RouteProcessFunction No

The function to run on the route and its children. The function receives a route argument which reflects the route being processed, and a component argument which reflects the instance of the component loaded for the route's corresponsind outlet. If the corresponding outlet wasn't marked with the publishComponent directive, the component argument will be null.

levels number No -1

(Optional) The number of levels (excluding the parent) to dive deeper into the route tree. A value of 1 for example, will process the route and its first-level children only. By default, scans all levels of the route tree.

Returns: void
observeRouteDeepScan
observeRouteDeepScan(route: ActivatedRouteSnapshot, componentBus, process: ObservedRouteProcessFunction, levels?: number)
Parameters:
Name Type Optional
route ActivatedRouteSnapshot No
componentBus No
process ObservedRouteProcessFunction No
levels number Yes
Returns: Observable<TReturn>
useRouteDeepScan
useRouteDeepScan(process: ObservedRouteProcessFunction, levels: number)

Creates an observable which, upon navigation end, deep scans the activated route by running the provided processing function.

Parameters:
Name Type Optional Default value Description
process ObservedRouteProcessFunction No

The function to run on the activated route and its children.

levels number No -1

(Optional) The number of levels (excluding the parent) to dive deeper into the route tree. A value of 1 for example, will process the route and its first-level children only. By default, scans all levels of the route tree.

Returns: Observable<TResult>

An observable which, upon navigation end, deep scans the activated route by running the provided processing function.

router-x/navigation/src/lib/_utils/_string-utils.ts

firstUpper
firstUpper(value: string)
Parameters:
Name Type Optional
value string No
Returns: string
touchFirstLetter
touchFirstLetter(undefined: string, touch)
Parameters:
Name Type Optional
string No
touch No
Returns: string

core/testing/src/utils/setup.ts

forceRoutingInsideAngularZone
forceRoutingInsideAngularZone(router: Router)

Wraps the navigate and navigateByUrl methods of the router with a call to NgZone.run(). Fixes the warning when using the router in unit tests.

Parameters:
Name Type Optional Description
router Router No

The router instance.

Returns: void
setupDocumentRefMock
setupDocumentRefMock()

Configures a testing module provided with a ready-to-use mock for DOCUMENT.

Any element created using DocumentRef.nativeDocument.createElement() will go through this mock. If a script element was requested, a MockScriptElement object is returned. If a link element was requested, the MockLinkElement object is returned. If any other tag name is requested, a new MockElement object is returned.

Used when testing head related services (e.g. HeadService, LazyLoaderService).

Internally, this plants the following structure in DocumentRef:

DocumentRef.nativeDocument.head -> MockHeadElement

DocumentRef.nativeDocument.createElement -> () => MockScriptElement | MockLinkElement | MockElement(<tagName>)

The returned mocks can be deconstructed like so:

Example :
let mockHeadElement: MockHeadElement;
let mockDocument   : any; 
({ mockHeadElement, mockDocument } = setupDocumentRefMock()); // mockDocument is also a jest.SpyInstance
Returns: literal type

router-x/navigation/src/lib/navigation-x.route-creator.ts

generateRouteComposerName
generateRouteComposerName(path: Path)
Parameters:
Name Type Optional
path Path No
routeConfigFor
routeConfigFor()

Creates a strongly-typed configurator for Angular routes.

Call this with an entity, then generate a strongly typed Angular route config tree using one of the configurator's functions.

Store the generated route somewhere and use provideRouterX() or provideRoutesX() to tell Angular about it.

An object which allows generating strongly typed routes.

async/src/utils/promiseLater.ts

promiseLater
promiseLater()

Creates a promise without which doesn't have the actual async code to resolve, and extracts its resolve() and reject() methods for later use. Use this when you have to create a promise for an async code that runs in a place different to the one where you create the promise, and it will allow you full control of the promise from other parts of your code.

Example :
import { promiseLater } from &#39;@bespunky/angular-zen/core&#39;;
// Other imports...</p>
<p>export class SomeDirective implements OnInit, OnChanges
{
    private const waitForInit: Promise<SomeType>;</p>
<pre><code>constructor()
{
    this.waitForInit = promiseLater();
}

ngOnInit()
{
    this.waitForInit.resolve();
}

ngOnChanges(changes: SimpleChanges)
{
    this.waitForInit.promise.then(() =&gt; {
        // ... Some code
    });
}
</code></pre>
<p>}
Returns: LatePromise<T>

An object containing the promise, anlong with its resolve() and reject() methods.

language/src/config/language-integration.provider.ts

provideLanguageIntegration
provideLanguageIntegration(__namedParameters: {useFactory: LanguageIntegrationProvider, deps, urlLocalization})

Generates language integration tokens and services to be provided in a module. Used by LanguageIntegrationModule.forRoot().

Parameters:
Name Type Optional
useFactory LanguageIntegrationProvider No
deps No
urlLocalization No
Returns: Provider[]

An array of providers for language integration.

router-x/src/config/router-x-config.provider.ts

provideRouterXConfig
provideRouterXConfig(config?: RouterXConfig)

Creates a provider for the router-x module configuration. Options not provided will be replaced with their default values according to DefaultRouterXConfig.

Parameters:
Name Type Optional
config RouterXConfig Yes
Returns: Provider

language/src/url-localization/config/url-localization.provider.ts

provideUrlLocalization
provideUrlLocalization(config?: UrlLocalizationConfig)

Creates the providers for the UrlLocalization token and the UrlLocalizer class.

Parameters:
Name Type Optional Description
config UrlLocalizationConfig Yes

(Optional) The configuration for url localization tools. Default is DefaultUrlLocalizationConfig.

Returns: Provider[]

The providers for the UrlLocalization token and the UrlLocalizer class.

provideUrlLocalizer
provideUrlLocalizer(config: UrlLocalizationConfig)

Creates the appropriate DI compatible provider for the UrlLocalizer class, depending on the strategy specified in the url localization configuration.
If the configured strategy is a number, RoutePositionUrlLocalizer will be used.
If the configured strategy is a string, QueryParamsUrlLocalizer will be used.
If the configured strategy is a valid UrlLocalizer provider, the provider will be used as is.
Otherwise, NoopUrlLocalizer will be used.

Parameters:
Name Type Optional Description
config UrlLocalizationConfig No

The url localization configuration holding the strategy.

Returns: ClassProvider | FactoryProvider

A DI compatible provider for the UrlLocalizer class with the implementation appropriate for the specified strategy.

router-x/utils/src/lib/use-router-outlet-tracker.ts

useActivatedRouteComponent
useActivatedRouteComponent()

Creates an observable which emits the latest component instance for the currently activated route.

An observable which emits the component instance for the currently activated route.

useRouterOutletStateTracker
useRouterOutletStateTracker()

Creates an observable which emits the latest state of the published router outlets in the app. The emitted state is a dictionary of outlet names and corresponding component instances.

Returns: Observable<Map<string, AnyObject | null>>

An observable which emits the latest state of the published router outlets in the app.

router-x/navigation/src/lib/navigation-x.injector.ts

useNavigationX
useNavigationX(route)

Injects the auto-generated strongly-typed navigation service for the specified route tree.

For this to work, the route must be previously generated using routeConfigForrouteConfigFor, and provided into Angular using either provideRouterXprovideRouterX or provideRoutesXprovideRoutesX.

To change the default composed name of a specific auto-generated navigation method, go to the corresponding route config and add the friendlyName propertyName.

Parameters:
Name Optional
route No

router-x/utils/src/lib/use-router-event.ts

useRouterEvent
useRouterEvent(eventType: Type)

Creates an observable which emits only the specified routing event.

Parameters:
Name Type Optional Description
eventType Type No

The type of router event to observe.

Returns: Observable<T>

An observable which emits only the specified routing event.

router-x/utils/src/lib/use-router-events.ts

useRouterEvents
useRouterEvents(...eventTypes: undefined)

Creates an observable which emits only the specified router events.

Parameters:
Name Optional
eventTypes No

An observable which emits only the specified router events.

core/src/window-ref/window-ref.service.ts

windowFactory
windowFactory(platformId: any)

Provides a platform dependant implementation for retrieving the window object.

Parameters:
Name Type Optional
platformId any No
Returns: Window | Object

window for browser platforms and a new object for non-browser platforms.

router-x/utils/src/lib/_wrap-in-macro-task.ts

wrapInMacroTask
wrapInMacroTask(observable: Observable, macroTaskNamePrefix: string)
Parameters:
Name Type Optional
observable Observable No
macroTaskNamePrefix string No
Returns: Observable<T>

results matching ""

    No results matching ""