From 38af3f3b7eb58c9cea9997650a67aefd99e0d92c Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Tue, 8 Mar 2016 17:54:16 +0800 Subject: [PATCH] Add caveat on the stateless natural of plug-ins --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7029006..630346c 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ This section serves as a simple walkthrough to how plug-ins work in MacDown unti 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. +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. + [dynamic-loading bundle]: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/LoadingCode/LoadingCode.html#//apple_ref/doc/uid/10000052-SW1