Skip to content

Commit 46993a4

Browse files
committed
fix doc comment
1 parent bad655f commit 46993a4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/core/src/api/API.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,13 @@ export abstract class API<Plugin extends IPlugin> {
758758

759759
/**
760760
* Subscribes to a property in meta binds metadata cache.
761-
* This returns a subscription that can be used to unsubscribe as well as update the cache.
762-
* IF YOU DON'T CALL `unsubscribe` THE SUBSCRIPTION WILL LEAK MEMORY.
761+
* This expects some sort of lifecycle hook to be passed in.
762+
* This method will register a callback to the lifecycle hook.
763+
* To unsubscribe the subscription, the callback registered to the lifecycle hook must be called.
764+
* In the context of Obsidian, you should pass a `Component` instance as the lifecycle hook and
765+
* make sure to unload the component when you are done using the metadata subscription.
766+
*
767+
* NOT UNSUBSCRIBING WILL LEAD TO MEMORY LEAKS.
763768
*
764769
* @param bindTarget
765770
* @param lifecycleHook In Obsidian this is an instance of the Component class. The subscription will be automatically unsubscribed when the component is unloaded.

0 commit comments

Comments
 (0)