diff --git a/listener.js b/listener.js index 9b63d1e..3808db9 100644 --- a/listener.js +++ b/listener.js @@ -39,24 +39,6 @@ export const listener = (target={}) => { return proxy } -export const bindContent = (listener, prop="value", target=document.createTextNode(""), filter) => { - const run = data => { - data = filter - ? filter(data) - : data - if ("innerText" in target) - if (typeof data == "string") - target.innerText = data - else - target.replaceChildren(data) - else - target.data = data - } - listener.listen(prop, run) - run(listener[prop]) - return target -} - export const text = (listener, prop) => { if (prop) { const node = document.createTextNode(listener[prop]) diff --git a/listener.md b/listener.md index 017e7e6..08aee40 100644 --- a/listener.md +++ b/listener.md @@ -33,21 +33,6 @@ property name. Note that repeatedly indexing the proxy will return a new text node each time. -```js -bindContent(listener, "value") -// Returns a text node with listener.value as its content -// that will change whenever the value is changed -bindContent(listener, "value", html_element) -// Binds an existng HTML or Text node -bindContent(listener, "value", html_element, value => value.toUpperCase()) -// Accepts a function to transform the value -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