Skip to content

Commit 38af3f3

Browse files
committed
Add caveat on the stateless natural of plug-ins
1 parent 176fe8d commit 38af3f3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ This section serves as a simple walkthrough to how plug-ins work in MacDown unti
3131

3232
A plugin in MacDown is a regular Cocoa [dynamic-loading bundle], with extension `.plugin`. MacDown searches `~/Library/Application Support/MacDown/PlugIns`, and build menu items for loadable bundles inside the directory. A plug-in in invoked when the user clicks on its corresponding menu item.
3333

34+
One caveat is that MacDown does *not* reuse plug-in instances between invocations; a new instance of re-created each time a method is called on the plug-in. This may change in the future, but as a rule of thumb, you should always treat your plug-in as stateless. Store things with `NSUserDefaults` or other persistence solutions.
35+
3436
[dynamic-loading bundle]: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/LoadingCode/LoadingCode.html#//apple_ref/doc/uid/10000052-SW1
3537

3638

0 commit comments

Comments
 (0)