Skip to content

Commit fdeb078

Browse files
authored
fix: Typo in defineDirective (Closes #35) (#36)
* fix: typo `updated` => `update` * Add the test page for a directive update
1 parent 042d761 commit fdeb078

3 files changed

Lines changed: 55 additions & 2 deletions

File tree

dist/vue-waypoint.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/directive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const defineDirective = Vue => {
1212
vnode._waypoint = waypoint
1313
}
1414
},
15-
updated (el, binding, vnode, oldVnode) {
15+
update (el, binding, vnode, oldVnode) {
1616
const { active, callback, options } = binding.value
1717

1818
// we remove the old observer anyways

test/update.html

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>vue-waypoint directive update test</title>
6+
<script src="https://unpkg.com/vue"></script>
7+
<script src="../dist/vue-waypoint.js"></script>
8+
<style>
9+
.wrapper {
10+
width: 300vw;
11+
height: 300vh;
12+
display: flex;
13+
justify-content: center;
14+
align-items: center;
15+
}
16+
.visible {
17+
background-color: #48e400;
18+
}
19+
.waypoint {
20+
width: 400px;
21+
height: 50px;
22+
}
23+
</style>
24+
</head>
25+
<body>
26+
<div id="app">
27+
<div class="wrapper" :class="{ visible }">
28+
<button
29+
v-waypoint="{ active, callback }"
30+
class="waypoint"
31+
@click="active = !active"
32+
>
33+
Waypoint holder (<b>click to {{ active ? 'deactivate' : 'activate' }}</b>)
34+
</button>
35+
</div>
36+
</div>
37+
38+
<script>
39+
var app = new Vue({
40+
el: '#app',
41+
data: {
42+
active: true,
43+
visible: false
44+
},
45+
methods: {
46+
callback({ going }) {
47+
this.visible = going == this.$waypointMap.GOING_IN
48+
}
49+
}
50+
})
51+
</script>
52+
</body>
53+
</html>

0 commit comments

Comments
 (0)