From b7e382d14707a9a0d06336de5799bc241b09f109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Fri, 26 Feb 2021 17:17:05 +0100 Subject: [PATCH] grammar improvements --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 977c08c..48e16ba 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # TypeScript support for Alpine.js -This package comes with a light TypeScript layer which provides full support for class components in Alpine.js. +This package provides full support for class components in Alpine.js using a thin TypeScript layer. It's used like this: @@ -11,7 +11,7 @@ import { DarkModeToggle } from './darkModeToggle'; Alpine.component('darkModeToggle', DarkModeToggle); ``` -**Use it the template** +**Use it a template** ```html
@@ -36,18 +36,18 @@ bootstrap(); ## Usage -You can get a component by calling `Alpine.component('component-name')(arg1, arg2)`. If your component has no arguments, still append the `()` after the call. +You can get a component by calling `Alpine.component('componentName')(arg1, arg2)`. If your component has no arguments, still append the `()` after the call. -The `component()` call itself returns a function that creates an instance of the component. Invoking the function ensures that the component has a unique instance each time. +The `component()` call itself returns a function for creating instances of the component. Invoking the function ensures that the component has a unique instance each time. ```html -
+
``` ```html -
+
...
@@ -104,7 +104,7 @@ registerComponents(files); You can create class components by extending `AlpineComponent` and exporting the class as `default`. -The `AlpineComponent` provides IDE support for Alpine's magic properties. This means that you can use `this.$el`, `this.$nextTick(() => this.foo = this.bar)`, and more with full type support. +`AlpineComponent` provides full IDE support for Alpine's magic properties. This means that you can use `this.$el`, `this.$nextTick(() => this.foo = this.bar)`, and more with perfect type enforcement. ```ts import { AlpineComponent } from '@leanadmin/alpine-typescript'; @@ -140,7 +140,7 @@ export default class DarkModeToggle extends AlpineComponent { ## Plain object components -To register a plain object as an Alpine component, return a function that wraps the object like this: +To register a plain object as an Alpine component, export a function that wraps the object like this: ```ts export default (foo: string, bar: number) => ({ foo, @@ -152,7 +152,7 @@ export default (foo: string, bar: number) => ({ }) ``` -The function will serve as a "constructor" for the object, setting default values and anything else you might need. +The function will serve as a "constructor" for the object, setting default values and anything else that's needed. Note that the `=> ({` part is just syntactic sugar, you're free to use `return` if it's useful in your case: