mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-28 13:31:06 +00:00
Merge pull request #511 from leevigraham/patch-1
Documentation updates THANK YOU!
This commit is contained in:
commit
03c395f773
15
www/api.md
15
www/api.md
@ -124,7 +124,7 @@ to provide custom SSE setup.
|
||||
// override SSE event sources to not use credentials
|
||||
htmx.createEventSource = function(url) {
|
||||
return new EventSource(url, {withCredentials:false});
|
||||
});
|
||||
};
|
||||
```
|
||||
|
||||
### <a name="createWebSocket"></a> Property - [`htmx.createWebSocket`](#createWebSocket)
|
||||
@ -141,7 +141,7 @@ to provide custom WebSocket setup.
|
||||
```js
|
||||
// override WebSocket to use a specific protocol
|
||||
htmx.createWebSocket = function(url) {
|
||||
return new WebSocket(url, ['wss']);;
|
||||
return new WebSocket(url, ['wss']);
|
||||
};
|
||||
```
|
||||
|
||||
@ -261,7 +261,7 @@ or
|
||||
htmx.off("click", myEventListener);
|
||||
|
||||
// remove this click listener from the given div
|
||||
var allParagraphsInMyDiv = htmx.off("#my-div", "click", myEventListener)
|
||||
htmx.off("#my-div", "click", myEventListener)
|
||||
```
|
||||
|
||||
### <a name="on"></a> Method - [`htmx.on()`](#on)
|
||||
@ -310,6 +310,8 @@ initializing the content with a javascript library
|
||||
|
||||
Parses an interval string consistent with the way htmx does. Useful for plugins that have timing-related attributes.
|
||||
|
||||
Caution: Accepts an int followed by either `s` or `ms`. All other values use `parseFloat`
|
||||
|
||||
##### Parameters
|
||||
|
||||
* `str` - timing string
|
||||
@ -319,6 +321,9 @@ Parses an interval string consistent with the way htmx does. Useful for plugins
|
||||
```js
|
||||
// returns 3000
|
||||
var milliseconds = htmx.parseInterval("3s");
|
||||
|
||||
// returns 3 - Caution
|
||||
var milliseconds = htmx.parseInterval("3m");
|
||||
```
|
||||
|
||||
### <a name="process"></a> Method - [`htmx.process()`](#process)
|
||||
@ -412,7 +417,7 @@ Toggles the given class on an element
|
||||
|
||||
```js
|
||||
// toggles the selected class on tab2
|
||||
htmx.toggle(htmx.find("#tab2"), "selected");
|
||||
htmx.toggleClass(htmx.find("#tab2"), "selected");
|
||||
```
|
||||
|
||||
### <a name="trigger"></a> Method - [`htmx.trigger()`](#trigger)
|
||||
@ -434,7 +439,7 @@ Triggers a given event on an element
|
||||
|
||||
### <a name="values"></a> Method - [`htmx.values()`](#values)
|
||||
|
||||
Returns the intput values that would resolve for a given element via the htmx value resolution mechanism
|
||||
Returns the input values that would resolve for a given element via the htmx value resolution mechanism
|
||||
|
||||
##### Parameters
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user