@dazn/kopytko-framework 1.3.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazn/kopytko-framework",
3
- "version": "1.3.3",
3
+ "version": "1.4.0",
4
4
  "description": "A modern Roku's Brightscript framework",
5
5
  "keywords": [
6
6
  "brightscript",
@@ -3,6 +3,8 @@ function KopytkoDOM() as Object
3
3
 
4
4
  prototype.componentsMapping = {}
5
5
 
6
+ prototype._renderedElements = {}
7
+
6
8
  ' Renders an element based on the given virtual node
7
9
  ' @param {Object} vNode - The virtual node
8
10
  ' @param {Object} parentElement - The parent element where the element will be rendered
@@ -45,6 +47,8 @@ function KopytkoDOM() as Object
45
47
  parentElement.appendChild(element)
46
48
  end if
47
49
 
50
+ m._renderedElements[element.id] = element
51
+
48
52
  m._setElementSelector(element)
49
53
  end sub
50
54
 
@@ -94,7 +98,7 @@ function KopytkoDOM() as Object
94
98
  rootElement = m._getRootComponent()
95
99
 
96
100
  for each elementId in elements
97
- element = rootElement.top.findNode(elementId)
101
+ element = m._renderedElements[elementId]
98
102
 
99
103
  if (element <> Invalid)
100
104
  m._destroyKopytkoElement(element)
@@ -106,6 +110,7 @@ function KopytkoDOM() as Object
106
110
  end if
107
111
 
108
112
  rootElement.delete(elementId)
113
+ m._renderedElements.delete(elementId)
109
114
  end for
110
115
  end sub
111
116
 
@@ -93,14 +93,14 @@ function StoreFacade() as Object
93
93
  end for
94
94
  end sub
95
95
 
96
- prototype.subscribeOnce = sub (key as String, callback as Function)
96
+ prototype.subscribeOnce = sub (key as String, callback as Function, context = Invalid as Object)
97
97
  m._handleSubscriber(key)
98
- m._subscriptions[m._getRandomizedKey(key)] = { key: key, callback: [callback], once: true }
98
+ m._subscriptions[m._getRandomizedKey(key)] = { key: key, callback: [callback], context: context, once: true }
99
99
  end sub
100
100
 
101
- prototype.subscribe = sub (key as String, callback as Function)
101
+ prototype.subscribe = sub (key as String, callback as Function, context = Invalid as Object)
102
102
  m._handleSubscriber(key)
103
- m._subscriptions[m._getRandomizedKey(key)] = { key: key, callback: [callback], once: false }
103
+ m._subscriptions[m._getRandomizedKey(key)] = { key: key, callback: [callback], context: context, once: false }
104
104
  end sub
105
105
 
106
106
  prototype.unsubscribe = sub (key as String, callback as Function)
@@ -144,7 +144,11 @@ function StoreFacade() as Object
144
144
  listener = m._subscriptions[subscriptionKey]
145
145
 
146
146
  if (listener <> Invalid AND listener.key = key)
147
- listener.callback[0](value)
147
+ if (listener.context = Invalid)
148
+ listener.callback[0](value)
149
+ else
150
+ listener.callback[0](value, listener.context)
151
+ end if
148
152
 
149
153
  if (listener.once)
150
154
  m._subscriptions.delete(subscriptionKey)
package/CHANGELOG.md DELETED
@@ -1,110 +0,0 @@
1
- ## [1.3.3](https://github.com/getndazn/kopytko-framework/compare/v1.3.2...v1.3.3) (2022-12-09)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * subscriptions remove own entries during iteration ([#36](https://github.com/getndazn/kopytko-framework/issues/36)) ([f67b6bd](https://github.com/getndazn/kopytko-framework/commit/f67b6bd5b209bb4ef2aa830b830162ee308a41ce))
7
-
8
- ## [1.3.2](https://github.com/getndazn/kopytko-framework/compare/v1.3.1...v1.3.2) (2022-09-01)
9
-
10
-
11
- ### Bug Fixes
12
-
13
- * Ignoring Invalid elements when calculating elements' index in children array ([#31](https://github.com/getndazn/kopytko-framework/issues/31)) ([73aed6e](https://github.com/getndazn/kopytko-framework/commit/73aed6e2e7ba38b946c81fe18ceecf414f7bbcf2))
14
-
15
- ## [1.3.1](https://github.com/getndazn/kopytko-framework/compare/v1.3.0...v1.3.1) (2022-08-05)
16
-
17
-
18
- ### Bug Fixes
19
-
20
- * update dependencies ([#35](https://github.com/getndazn/kopytko-framework/issues/35)) ([7e317e0](https://github.com/getndazn/kopytko-framework/commit/7e317e0850cec411832318bf1491c8375c219cad))
21
-
22
- # [1.3.0](https://github.com/getndazn/kopytko-framework/compare/v1.2.0...v1.3.0) (2022-08-01)
23
-
24
-
25
- ### Features
26
-
27
- * enhanced destroyKopytkoRoot to call destroyKopytko ([#34](https://github.com/getndazn/kopytko-framework/issues/34)) ([c21c2bb](https://github.com/getndazn/kopytko-framework/commit/c21c2bb61bae0f165d2a68341aa1cfb75d13a6b8))
28
-
29
- # [1.2.0](https://github.com/getndazn/kopytko-framework/compare/v1.1.2...v1.2.0) (2022-08-01)
30
-
31
-
32
- ### Features
33
-
34
- * introduced KopytkoRoot that makes integration easier ([#32](https://github.com/getndazn/kopytko-framework/issues/32)) ([11efb22](https://github.com/getndazn/kopytko-framework/commit/11efb228d1e75d0020e1279f61ef1075dcc0f3e4))
35
-
36
- ## [1.1.2](https://github.com/getndazn/kopytko-framework/compare/v1.1.1...v1.1.2) (2022-07-14)
37
-
38
-
39
- ### Bug Fixes
40
-
41
- * allow to render array of elements in root component ([#30](https://github.com/getndazn/kopytko-framework/issues/30)) ([8609122](https://github.com/getndazn/kopytko-framework/commit/8609122e3008009802eaa1865f5ee7756392afa3))
42
-
43
- ## [1.1.1](https://github.com/getndazn/kopytko-framework/compare/v1.1.0...v1.1.1) (2022-06-02)
44
-
45
-
46
- ### Bug Fixes
47
-
48
- * validating parent when removing children from Kopytko component ([#29](https://github.com/getndazn/kopytko-framework/issues/29)) ([fefe313](https://github.com/getndazn/kopytko-framework/commit/fefe31360aa3d90ab7f97ecd5ac422530fe9351e))
49
-
50
- # [1.1.0](https://github.com/getndazn/kopytko-framework/compare/v1.0.6...v1.1.0) (2022-05-20)
51
-
52
-
53
- ### Features
54
-
55
- * added enqueueUpdate function to reduce number of rerenders ([#28](https://github.com/getndazn/kopytko-framework/issues/28)) ([4c80273](https://github.com/getndazn/kopytko-framework/commit/4c80273af7c20ded4bc41cdb94647142b209695f))
56
-
57
- ## [1.0.6](https://github.com/getndazn/kopytko-framework/compare/v1.0.5...v1.0.6) (2022-05-20)
58
-
59
-
60
- ### Bug Fixes
61
-
62
- * not calling state update callbacks if kopytko is not mounted ([#27](https://github.com/getndazn/kopytko-framework/issues/27)) ([27d5618](https://github.com/getndazn/kopytko-framework/commit/27d5618909e7fd266db71e88acfa63071b037921))
63
-
64
- ## [1.0.5](https://github.com/getndazn/kopytko-framework/compare/v1.0.4...v1.0.5) (2022-05-19)
65
-
66
-
67
- ### Bug Fixes
68
-
69
- * expose response headers in HttpResponse ([#26](https://github.com/getndazn/kopytko-framework/issues/26)) ([5517ff2](https://github.com/getndazn/kopytko-framework/commit/5517ff2eaff9d11a8d81ada9ea390288eb049d15))
70
-
71
- ## [1.0.4](https://github.com/getndazn/kopytko-framework/compare/v1.0.3...v1.0.4) (2022-04-11)
72
-
73
-
74
- ### Bug Fixes
75
-
76
- * active route should skip is omitted in history ([#24](https://github.com/getndazn/kopytko-framework/issues/24)) ([970ff96](https://github.com/getndazn/kopytko-framework/commit/970ff9662376a909f1018b452a04b4cf5378a446))
77
-
78
- ## [1.0.3](https://github.com/getndazn/kopytko-framework/compare/v1.0.2...v1.0.3) (2022-03-04)
79
-
80
-
81
- ### Bug Fixes
82
-
83
- * update dependencies ([#19](https://github.com/getndazn/kopytko-framework/issues/19)) ([4652ec2](https://github.com/getndazn/kopytko-framework/commit/4652ec2201292083b8202acb624674de8cd8275e))
84
-
85
- ## [1.0.2](https://github.com/getndazn/kopytko-framework/compare/v1.0.1...v1.0.2) (2021-12-03)
86
-
87
-
88
- ### Bug Fixes
89
-
90
- * **deps:** Fixed npm urls ([#17](https://github.com/getndazn/kopytko-framework/issues/17)) ([32443a2](https://github.com/getndazn/kopytko-framework/commit/32443a2eb3973640fd2315dcf85b6abc1d54e2d3))
91
-
92
- ## [1.0.1](https://github.com/getndazn/kopytko-framework/compare/v1.0.0...v1.0.1) (2021-10-01)
93
-
94
-
95
- ### Bug Fixes
96
-
97
- * Fixed Modal property ([#16](https://github.com/getndazn/kopytko-framework/issues/16)) ([ed36d04](https://github.com/getndazn/kopytko-framework/commit/ed36d04379b859afaa9411769554ee0ef2b3cd08))
98
-
99
- # 1.0.0 (2021-10-01)
100
-
101
-
102
- ### Bug Fixes
103
-
104
- * Removed ThemeFacade import in ModalComponent ([#8](https://github.com/getndazn/kopytko-framework/issues/8)) ([ad60b1a](https://github.com/getndazn/kopytko-framework/commit/ad60b1a3ad2d0ee77c21d83a92f8b34a62c30e78))
105
-
106
-
107
- ### Features
108
-
109
- * Added Registry docs ([#6](https://github.com/getndazn/kopytko-framework/issues/6)) ([37be695](https://github.com/getndazn/kopytko-framework/commit/37be69596e900ef898f671435fd1311387702b72))
110
- * EventBus docs added ([#11](https://github.com/getndazn/kopytko-framework/issues/11)) ([7c968c3](https://github.com/getndazn/kopytko-framework/commit/7c968c3ef3e53b499543ba5ef5bda733798d8363))