Skip to content

Commit

Permalink
Merge pull request #8 from ChristoPy/develop
Browse files Browse the repository at this point in the history
Version v0.0.3
  • Loading branch information
ChristoPy authored Oct 23, 2021
2 parents ce94a47 + 3c95a55 commit dd78ec9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ The available ones are:
Soon

# Version
0.0.2, not stable nor production ready, use with caution
0.0.3, not stable nor production ready, use with caution
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kuva",
"version": "0.0.2",
"version": "0.0.3",
"description": "Lightweight and straightforward reactive front-end library.",
"main": "dist/index.js",
"files": ["dist/*"],
Expand Down
30 changes: 15 additions & 15 deletions src/directives.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
import { valueToText, get } from './shared.js'

let directives = [
{
name: "if",
elements: [],
handler: (element, data, value) => {
const comment = document.createComment('')

const innerHandler = () => {
if (!data[value]) element.replaceWith(comment)
else comment.replaceWith(element)
}

innerHandler()
return innerHandler
}
},
{
name: "hide",
elements: [],
Expand Down Expand Up @@ -47,6 +32,21 @@ let directives = [

const innerHandler = () => element.value = data[value]

innerHandler()
return innerHandler
}
},
{
name: "if",
elements: [],
handler: (element, data, value) => {
const comment = document.createComment('')

const innerHandler = () => {
if (!data[value]) element.replaceWith(comment)
else comment.replaceWith(element)
}

innerHandler()
return innerHandler
}
Expand Down

0 comments on commit dd78ec9

Please sign in to comment.