Skip to content

Commit 4ae475e

Browse files
authored
docs(scully): add docs about ng-lib
* docs(scully): add docs about ng-lib * docs(scully): refactor ng-lib docs * docs(scully): fix typo
1 parent d0ac97a commit 4ae475e

3 files changed

Lines changed: 106 additions & 1 deletion

File tree

docs/scully-configuration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export interface ScullyConfig {
5050

5151
`projectRoot` is reference to the path to the project where scully will intervene.
5252

53-
This property is **_mandatory_**, scully fill automatically post installation.
53+
This property is **_mandatory_**, scully fill automatically post installation,
54+
55+
**_IMPORTANT_** this property won't be **_mandatory_** anymore in future releases.
5456

5557
### homeFolder
5658

docs/scully-lib-core.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Scully Core
2+
3+
## Idle Monitor
4+
5+
Scully implements the `IdleMonitorService` to hook into Zonejs. When angular goes idle (**more precise, when all outgoing HTTP-requests are settled**)
6+
Scully trigger Puppeteer, and knows when it's ready to render.
7+
8+
Without this process, we have to resort to a (25 seconds) timeout. this is both slower and unprecise, some pages need even more time.
9+
10+
`IdleMonitorService` is available in `ScullyLibModule`.
11+
12+
## Router Service
13+
14+
`ScullyRoutesService` is an service to provide to the user access to certains methods and observables to know
15+
the routes rendered by Scully.
16+
17+
- available\$
18+
- unPublished\$
19+
- topLevel\$
20+
- getCurrent()
21+
- reload()
22+
23+
The `ScullyRoutesService` use the `ScullyRoute` interface to set types.
24+
25+
```typescript
26+
export interface ScullyRoute {
27+
route: string;
28+
title?: string;
29+
slugs?: string[];
30+
published?: boolean;
31+
slug?: string;
32+
[prop: string]: any;
33+
}
34+
```
35+
36+
#### available\$: _Observable<ScullyRoute[]>_
37+
38+
`available$` returns routes with the property `published` with value true.
39+
40+
#### unPublished\$: _Observable<ScullyRoute[]>_
41+
42+
`unPublished$` returns routes with the property `published` with value false.
43+
44+
#### topLevel\$: _Observable<ScullyRoute[]>_
45+
46+
`topLevel$` returns top level routes.
47+
48+
#### getCurrent(): _Observable<ScullyRoute>_
49+
50+
`getCurrent()` method returns the current location
51+
52+
#### reload(): _void_
53+
54+
`reload` method checks if new routes was added in the `scully-routes.json`.
55+
56+
## Scully Content
57+
58+
Scully use the `scully-content` to insert the result of the render process into the HTML document.
59+
60+
The `scully-content` component won't work inside a `*ngIf` directive.
61+
62+
## Transfer State
63+
64+
The `TransferStateService` allows transfer the state of the Angular application to the static site rendered by Scully.
65+
66+
To set or get the state of the application you can use 2 methods:
67+
68+
- getState
69+
- setState
70+
71+
#### getState
72+
73+
`getState` will return an observable that fires once and completes. It does so right after the navigation for the page has finished.
74+
75+
```typescript
76+
getState<T>(name: string): Observable<T>
77+
```
78+
79+
#### setState
80+
81+
`setState` will set values to the property key.
82+
83+
```typescript
84+
setState<T>(name: string, val: T): void
85+
```
86+
87+
## Utils
88+
89+
#### Is Scully
90+
91+
- isScullyRunning()
92+
- isScullyGenerated()
93+
94+
##### isScullyRunning(): _boolean_
95+
96+
`isScullyRunning` returns `true` or `false` if Scully build is happening.
97+
98+
##### isScullyGenerated(): _boolean_
99+
100+
`isScullyGenerated` returns `true` if Scully build has run.
101+
102+
[Full Documentation ➡️](scully.md)

docs/scully.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Visit one of the following topics:
1818
- [Getting Started](getting-started.md)
1919
- [Scully Configuration](scully-configuration.md)
2020
- [Scully command line options](./scully-cmd-line.md)
21+
- [Scully Core](./scully-lib-core.md)
2122
- [Adding Blog Support](blog.md)
2223
- [Working with Plugins](plugins.md)
2324
- [Polyfills](polyfills.md)

0 commit comments

Comments
 (0)