Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The following sections covers the three different configurations of preboot:

#### Angular Configuration

```typescript
```ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { PrebootModule } from 'preboot';
Expand Down Expand Up @@ -116,7 +116,7 @@ yourself once you know that all async events are complete.

To manually trigger replay, inject the EventReplayer like this:

```
```ts
import { Injectable } from '@angular/core';
import { EventReplayer } from 'preboot';

Expand Down Expand Up @@ -176,7 +176,7 @@ Preboot registers its reply code at the `APP_BOOTSTRAP_LISTENER` token which is

To make Preboot work correctly in such a case you need to specify `replay: false` in the Preboot options and replay the events yourself. That is, import `PrebootModule` like this:

```typescript
```ts
PrebootModule.withConfig({
appRoot: 'app-root',
replay: false,
Expand All @@ -185,7 +185,7 @@ PrebootModule.withConfig({

and replay events in `AppComponent` like this:

```typescript
```ts
import { isPlatformBrowser } from '@angular/common';
import { Component, OnInit, PLATFORM_ID, Inject, ApplicationRef } from '@angular/core';
import { Router } from '@angular/router';
Expand Down Expand Up @@ -226,7 +226,7 @@ When you are manually replaying events, you often will want to know when Preboot
is done replaying events and switching the buffers. To do this, use the following
code in your app:

```
```es6
window.document.addEventListener('PrebootComplete', () => {
// put your code here that you want to run once preboot is complete
});
Expand All @@ -238,7 +238,7 @@ If you're using a CSP, you'll need to add a `nonce` property to preboot's inline
Preboot allows you to configure this by exporting an optional `PREBOOT_NONCE` token.
Example usage is as follows (for an Express server):

```typescript
```ts
import {PREBOOT_NONCE} from 'preboot';
import * as express from 'express';
import {v4} from 'uuid';
Expand Down Expand Up @@ -283,7 +283,7 @@ Please note that only the nonce tag will appear on the script,
sure your nonce is generating correctly, you can add a callback
onto your render method to examine the resultant HTML as follows:

```typescript
```ts
res.render('index', (req, res) => {
...
}, function(error, html) {
Expand Down