BlockSuite API Documentation / @blocksuite/blocks / FontLoaderService
Class: FontLoaderService 
A life cycle watcher is an extension that watches the life cycle of the editor. It is used to perform actions when the editor is created, mounted, rendered, or unmounted.
When creating a life cycle watcher, you must define a key that is unique to the watcher. The key is used to identify the watcher in the dependency injection container.
class MyLifeCycleWatcher extends LifeCycleWatcher {
 static override readonly key = 'my-life-cycle-watcher';In the life cycle watcher, the methods will be called in the following order:
created: Called when the std is created.rendered: Called whenstd.renderis called.mounted: Called when the editor host is mounted.unmounted: Called when the editor host is unmounted.
Extends 
Constructors 
new FontLoaderService() 
new FontLoaderService(
std):FontLoaderService
Parameters 
• std: BlockStdScope
Returns 
Inherited from 
Defined in 
packages/framework/block-std/dist/extension/lifecycle-watcher.d.ts:24
Properties 
fontFaces 
readonlyfontFaces:FontFace[]
Defined in 
packages/affine/shared/dist/services/font-loader/font-loader-service.d.ts:5
std 
readonlystd:BlockStdScope
Inherited from 
Defined in 
packages/framework/block-std/dist/extension/lifecycle-watcher.d.ts:22
key 
readonlystatickey:"font-loader"="font-loader"
Overrides 
Defined in 
packages/affine/shared/dist/services/font-loader/font-loader-service.d.ts:4
Accessors 
ready 
getready():Promise<FontFace[]>
Returns 
Promise<FontFace[]>
Defined in 
packages/affine/shared/dist/services/font-loader/font-loader-service.d.ts:6
Methods 
created() 
created():
void
Called when std is created.
Returns 
void
Inherited from 
Defined in 
packages/framework/block-std/dist/extension/lifecycle-watcher.d.ts:29
load() 
load(
fonts):void
Parameters 
• fonts: FontConfig[]
Returns 
void
Defined in 
packages/affine/shared/dist/services/font-loader/font-loader-service.d.ts:7
mounted() 
mounted():
void
Called when editor host is mounted. Which means the editor host emit the connectedCallback lifecycle event.
Returns 
void
Overrides 
Defined in 
packages/affine/shared/dist/services/font-loader/font-loader-service.d.ts:8
rendered() 
rendered():
void
Called when std.render is called.
Returns 
void
Inherited from 
Defined in 
packages/framework/block-std/dist/extension/lifecycle-watcher.d.ts:38
unmounted() 
unmounted():
void
Called when editor host is unmounted. Which means the editor host emit the disconnectedCallback lifecycle event.
Returns 
void
Overrides 
Defined in 
packages/affine/shared/dist/services/font-loader/font-loader-service.d.ts:9
setup() 
staticsetup(di):void
Parameters 
• di: Container
Returns 
void
Inherited from 
Defined in 
packages/framework/block-std/dist/extension/lifecycle-watcher.d.ts:25