pinkman 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31a9308efa0befc57d8b9a1c28ee69af741e4d4b8f250d1f604c75bb0a0d5a7b
|
4
|
+
data.tar.gz: bd886c701af5ffccbce68bb1d3399a36ded3cf8e9a35ce5b9feede5c7625fa04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bc1f5040511a5dd49aa98049c859f0db640b7309037690198a3592c692fd935a5f44b4b6e5af8b617b5e71a95a9e3fa7514c19cebb61978b0b9bf1646c3857b
|
7
|
+
data.tar.gz: 4bc59821dd418ee40a6eea96149f40e5f7028dfe18580b18f81a7979aaea2165b85ee57e4ebe1cad52ea8950c0e342fb7e8562c246226e605dd6bc8dda2e44fe
|
@@ -18,6 +18,7 @@ Pinkman.closest = (jquery,level=0) ->
|
|
18
18
|
class window.PinkmanController extends window.PinkmanObject
|
19
19
|
|
20
20
|
clear: ->
|
21
|
+
@clearSubscriptions()
|
21
22
|
@actions.each (a) ->
|
22
23
|
a.clear()
|
23
24
|
|
@@ -26,6 +27,7 @@ class window.PinkmanController extends window.PinkmanObject
|
|
26
27
|
|
27
28
|
constructor: (args...) ->
|
28
29
|
@actions = new PinkmanActions
|
30
|
+
@subscriptions = []
|
29
31
|
super(args...)
|
30
32
|
|
31
33
|
selector: ->
|
@@ -294,7 +296,15 @@ class window.PinkmanController extends window.PinkmanObject
|
|
294
296
|
|
295
297
|
endBottom: () ->
|
296
298
|
Pinkman._bottomTriggered = false
|
297
|
-
|
299
|
+
|
300
|
+
clearSubscriptions: ->
|
301
|
+
i = 0
|
302
|
+
for sub in @subscriptions
|
303
|
+
i = i + 1
|
304
|
+
sub.unsubscribe()
|
305
|
+
# console.log sub
|
306
|
+
# console.log 'unsubscribed'
|
307
|
+
@subscriptions = [] if i == @subscriptions.length
|
298
308
|
|
299
309
|
subscribe: (channel,opt) ->
|
300
310
|
throw 'ActionCable not found.' unless Pinkman.cable?
|
@@ -313,7 +323,7 @@ class window.PinkmanController extends window.PinkmanObject
|
|
313
323
|
params.room = opt.room
|
314
324
|
params.scope = opt.scope
|
315
325
|
params.filter_by = (opt.filter_by or opt.filterBy ) if (opt.filterBy? or opt.filter_by?)
|
316
|
-
Pinkman.cable.subscriptions.create params, received: callback
|
326
|
+
@subscriptions.push(Pinkman.cable.subscriptions.create params, received: callback)
|
317
327
|
|
318
328
|
scrolling: (callback) ->
|
319
329
|
$(document).on 'scroll', =>
|
@@ -377,7 +387,7 @@ class window.PinkmanAction extends window.PinkmanObject
|
|
377
387
|
@_event_listening = new Object
|
378
388
|
super(args...)
|
379
389
|
@call = ->
|
380
|
-
@
|
390
|
+
@_events = []
|
381
391
|
|
382
392
|
# helper to define custom actions
|
383
393
|
@define: (options) ->
|
@@ -432,15 +442,16 @@ class window.PinkmanAction extends window.PinkmanObject
|
|
432
442
|
# Desc: removes event
|
433
443
|
clear: ->
|
434
444
|
@_event_listening = new Object
|
435
|
-
for ev in @
|
445
|
+
for ev in @_events
|
436
446
|
$('body').off ev, @selector
|
447
|
+
|
437
448
|
|
438
449
|
# Desc: attaches one single event
|
439
450
|
attach: (eventName) ->
|
440
451
|
if Pinkman.isString(eventName) and not @_event_listening[eventName]
|
441
452
|
action = this
|
442
453
|
action._event_listening[eventName] = yes
|
443
|
-
@
|
454
|
+
@_events.push(eventName)
|
444
455
|
$('body').on eventName, action.selector, (ev) ->
|
445
456
|
# debugger
|
446
457
|
# console.log "#{action.id}: called - #{action.name}"
|
@@ -97,6 +97,7 @@ class window.PinkmanRouteMatcher extends Pinkman.object
|
|
97
97
|
if @controllers.any()?
|
98
98
|
Pinkman.controllers.unbindScrolling()
|
99
99
|
# console.log 'clear dos Pinkman.controllers'
|
100
|
+
|
100
101
|
@controllers.each (c) =>
|
101
102
|
# console.log 'dentro dos controllers desse router'
|
102
103
|
c.setParams(@params())
|
@@ -272,6 +273,11 @@ class window.PinkmanRouter
|
|
272
273
|
r = Pinkman.routes.match(path)
|
273
274
|
if r? and r
|
274
275
|
@previousMatcher = @currentMatcher if @currentMatcher?
|
276
|
+
|
277
|
+
if @previousMatcher?
|
278
|
+
@previousMatcher.controllers.each (c) ->
|
279
|
+
c.clearSubscriptions()
|
280
|
+
|
275
281
|
@currentMatcher = r
|
276
282
|
# console.log r
|
277
283
|
r.options = options
|
data/lib/pinkman/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pinkman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agilso Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|