Skip to content

Commit 2a0bc35

Browse files
committed
2.0
1 parent 1c34842 commit 2a0bc35

File tree

5 files changed

+34
-27
lines changed

5 files changed

+34
-27
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Fires an event on a specific scroll position
99

1010
```sh
1111
npm install --save-dev vue-scrollfire
12+
13+
npm install --save-dev vue-scrollfire@1
1214
```
1315
or include `build/bundle.js`.
1416

@@ -44,8 +46,11 @@ progress | will be fired on scrolling of viewport. Argument: `{top,bottom}`
4446
left | will be fired on leaving of viewport
4547

4648
## Changelog
49+
- 2.0.0
50+
added vue 2.0.0 compatibility
51+
`Number` props must be set like this `:after=100`, this isn't working anymore: `after=100`
4752

48-
- 1.0.0
53+
- 1.0.0
4954
now has `left` event
5055
uses parent for size calculation
5156

dev/basic.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
a(href="https://github.com/vue-comps/vue-comps-scrollspy/blob/master/dev/basic.vue") source
44
p open console and scroll down
55
p try reloading the page at the bottom to see the effect of `initial` prop and scroll up
6-
div(style="margin-top:1500px;width:200px;height:200px;background-color:blue",v-el:div) div
6+
div(style="margin-top:1500px;width:200px;height:200px;background-color:blue",ref="div") div
77
scrollfire(@entered="entered", @left="left", @progress="progress", multiple)
8-
scrollfire(@entered="enteredOffset",@left="leftOffset",offset=200)
9-
scrollfire(@entered="enteredNegativOffset",offset=-200)
10-
scrollfire(@entered="enteredAfter",after=1000)
8+
scrollfire(@entered="enteredOffset",@left="leftOffset",:offset=200)
9+
scrollfire(@entered="enteredNegativOffset",:offset=-200)
10+
scrollfire(@entered="enteredAfter",:after=1000)
1111
scrollfire(@entered="initial", @left="initialLeft", initial)
1212
</template>
1313

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,33 @@
1717
"node": "*"
1818
},
1919
"dependencies": {
20-
"vue-mixins": "^0.3.0"
20+
"vue-mixins": "^0.3.4"
2121
},
2222
"devDependencies": {
2323
"chai": "^3.5.0",
2424
"chai-spies": "^0.7.1",
2525
"coffee-loader": "^0.7.2",
26-
"coffee-script": "^1.10.0",
26+
"coffee-script": "^1.11.1",
2727
"gh-pages": "^0.11.0",
28-
"karma": "^1.2.0",
28+
"karma": "^1.3.0",
2929
"karma-chai": "^0.1.0",
3030
"karma-chai-dom": "^1.1.0",
3131
"karma-chai-spies": "^0.1.4",
3232
"karma-chrome-launcher": "^2.0.0",
3333
"karma-firefox-launcher": "^1.0.0",
34-
"karma-mocha": "^1.1.1",
34+
"karma-mocha": "^1.2.0",
3535
"karma-sourcemap-loader": "^0.3.7",
3636
"karma-spec-reporter": "^0.0.26",
37-
"karma-vue-component": "^0.1.0",
37+
"karma-vue-component": "^2.0.1",
3838
"karma-webpack": "^1.8.0",
39-
"mocha": "^3.0.2",
39+
"mocha": "^3.1.2",
4040
"pug": "^2.0.0-beta6",
41-
"script-runner": "^0.1.5",
42-
"vue": "^1.0.26",
43-
"vue-compiler": "^0.3.0",
44-
"vue-dev-server": "^0.2.10",
41+
"script-runner": "^0.1.6",
42+
"vue": "^2.0.3",
43+
"vue-compiler": "^2.0.0",
44+
"vue-dev-server": "^2.0.1",
4545
"vue-html-loader": "^1.2.3",
46-
"vue-loader": "^8.5.2",
46+
"vue-loader": "^9.7.0",
4747
"webpack": "^1.13.2"
4848
},
4949
"keywords": [

src/scrollfire.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ module.exports =
6565
getHeight: ->
6666
@height = @getViewportSize().height
6767
compiled: ->
68+
69+
70+
mounted: -> @$nextTick ->
6871
@state = {entered:false,left:false}
6972
@getHeight()
7073
@onWindowResize @getHeight
7174
@disposeListener = @onWindowScroll @processScroll
72-
73-
ready: ->
7475
@target = if @ignoreParent then @$el else @$el.parentElement
7576
@processScroll()
7677

test/scrollfire.coffee

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe "scrollfire", ->
1313
describe "basic env", ->
1414

1515
before (done) ->
16-
basic.compiled = ->
16+
basic.created = ->
1717
@entered = chai.spy("entered")
1818
@left = chai.spy("left")
1919
@progress = chai.spy("progress")
@@ -32,7 +32,7 @@ describe "scrollfire", ->
3232
#unloadComp(env)
3333

3434
it "should work on scrolling down", (done) ->
35-
box = env.$els.div.getBoundingClientRect()
35+
box = env.$refs.div.getBoundingClientRect()
3636
top = box.top
3737
bottom = box.bottom
3838
timeoutCalled = false
@@ -63,26 +63,27 @@ describe "scrollfire", ->
6363
timeoutCalled = false
6464
finished = false
6565
scroll 4000, ->
66-
env.$destroy(true)
66+
document.body.removeChild(env.$el)
67+
env.$destroy()
6768
env = loadComp(basic)
68-
env.$nextTick ->
69+
env.$nextTick -> env.$nextTick ->
6970
env.initial.should.be.called.once
7071
env.initialLeft.should.be.called.once
71-
scroll env.$els.div.offsetTop+env.$els.div.offsetHeight+200, ->
72+
scroll env.$refs.div.offsetTop+env.$refs.div.offsetHeight+200, ->
7273
env.enteredNegativOffset.should.be.called.once
73-
scroll env.$els.div.offsetTop+env.$els.div.offsetHeight, ->
74+
scroll env.$refs.div.offsetTop+env.$refs.div.offsetHeight, ->
7475
env.entered.should.be.called.once
7576
setTimeout (->
7677
env.enteredAfter.should.be.called.once
7778
timeoutCalled = true
7879
done() if finished
7980
),1010
80-
scroll env.$els.div.offsetTop + env.$els.div.offsetHeight - 200, ->
81+
scroll env.$refs.div.offsetTop + env.$refs.div.offsetHeight - 200, ->
8182
env.enteredOffset.should.be.called.once
8283
env.progress.should.be.called.once
83-
scroll env.$els.div.offsetTop - vp.height, ->
84+
scroll env.$refs.div.offsetTop - vp.height, ->
8485
env.left.should.be.called.once
85-
scroll env.$els.div.offsetTop - vp.height - 200, ->
86+
scroll env.$refs.div.offsetTop - vp.height - 200, ->
8687
env.left.should.be.called.once
8788
finished = true
8889
done() if timeoutCalled

0 commit comments

Comments
 (0)