diff --git a/listener.js b/listener.js index 24c4ed7..e64d682 100644 --- a/listener.js +++ b/listener.js @@ -39,7 +39,7 @@ export const listener = (target={}) => { return proxy } -export const bind = (listener, prop, target=document.createTextNode(""), filter) => { +export const bindContent = (listener, prop="value", target=document.createTextNode(""), filter) => { const run = data => { data = filter ? filter(data) diff --git a/listener.md b/listener.md index 3d31336..b3e6719 100644 --- a/listener.md +++ b/listener.md @@ -16,17 +16,20 @@ listener.listen(prop) ``` ```js -bind(listener, "value") +bindContent(listener, "value") // Returns a text node with listener.value as its content // that will change whenever the value is changed -bind(listener, "value", html_element) +bindContent(listener, "value", html_element) // Binds an existng HTML or Text node -bind(listener, "value", html_element, value => value.toUpperCase()) +bindContent(listener, "value", html_element, value => value.toUpperCase()) // Accepts a function to transform the value -bind(listener, "value", html_element, value => document.createElement("hr")) +bindContent(listener, "value", html_element, value => document.createElement("hr")) // Also accepts HTML elements when the target is not a text node ``` +This function *may* be **removed** in the future if it doesn't show any +usefullnes that isn't already provided by the skooma bind function. + ## Example ```js