瀏覽代碼

chore(docs)

Ryan Chandler 5 年之前
父節點
當前提交
a2e160804d
共有 4 個文件被更改,包括 18 次插入12 次删除
  1. 9 1
      README.md
  2. 0 5
      examples/index.html
  3. 7 0
      examples/store.js
  4. 2 6
      examples/test.js

+ 9 - 1
README.md

@@ -6,6 +6,10 @@
 
 
 A lightweight state management layer for Alpine.js
 A lightweight state management layer for Alpine.js
 
 
+## About
+
+Many large frameworks have their own state management solutions. One thing these libraries have in common is a higher level of complexity and a wide range of API interactions. Since Alpine.js is designed to be a simpler and lighter alternative to larger frameworks such as Vue and React, shouldn't the state management solution be as simple, if not simpler, too?
+
 ## Installation
 ## Installation
 
 
 ### CDN
 ### CDN
@@ -30,4 +34,8 @@ Then add the following to your script:
 
 
 ```javascript
 ```javascript
 import Spruce from '@ryangjchandler/spruce'
 import Spruce from '@ryangjchandler/spruce'
-```
+```
+
+## Usage
+
+Spruce exposes less than a handful of possible interaction points. There is an extremely simple "subscriptions" interaction which connects the roots from your Alpine component to the global store, then there is the "stores" interaction which allows you to define scopes of global state for use throughout your components.

+ 0 - 5
examples/index.html

@@ -15,10 +15,5 @@
         <div x-data x-subscribe>
         <div x-data x-subscribe>
             <button @click="$store.dropdown.hello = 'amazing'">Update world to amazing</button>
             <button @click="$store.dropdown.hello = 'amazing'">Update world to amazing</button>
         </div>
         </div>
-        <!-- <script>
-            Spruce.store('dropdown', {
-                hello: 'world'
-            })
-        </script> -->
     </body>
     </body>
 </html>
 </html>

+ 7 - 0
examples/store.js

@@ -0,0 +1,7 @@
+import Spruce from '../dist/spruce.module.js'
+
+Spruce.store('dropdown', {
+    hello: 'world'
+})
+
+export default Spruce

+ 2 - 6
examples/test.js

@@ -1,8 +1,4 @@
-import Spruce from '../dist/spruce.module.js'
+import Store from './store.js'
 
 
-Spruce.store('dropdown', {
-    hello: 'world'
-})
-
-window.Spruce = Spruce
+window.Spruce = Store
 window.Spruce.start()
 window.Spruce.start()