@quenty/binder 8.17.0 → 9.0.0-canary.367.e9fdcbc.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/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [8.17.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/binder@8.16.0...@quenty/binder@8.17.0) (2023-06-05)
6
+ # [9.0.0-canary.367.e9fdcbc.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/binder@8.16.0...@quenty/binder@9.0.0-canary.367.e9fdcbc.0) (2023-06-05)
7
7
 
8
8
  **Note:** Version bump only for package @quenty/binder
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/binder",
3
- "version": "8.17.0",
3
+ "version": "9.0.0-canary.367.e9fdcbc.0",
4
4
  "description": "Utility object to Bind a class to Roblox object, and associated helper methods",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,18 +25,18 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/baseobject": "^6.2.1",
29
- "@quenty/brio": "^8.13.0",
30
- "@quenty/instanceutils": "^7.14.0",
31
- "@quenty/linkutils": "^7.14.0",
32
- "@quenty/loader": "^6.2.1",
33
- "@quenty/maid": "^2.5.0",
34
- "@quenty/promise": "^6.5.0",
35
- "@quenty/signal": "^2.4.0",
36
- "@quenty/valueobject": "^7.15.0"
28
+ "@quenty/baseobject": "6.2.1",
29
+ "@quenty/brio": "8.13.0",
30
+ "@quenty/instanceutils": "7.14.0",
31
+ "@quenty/linkutils": "7.14.0",
32
+ "@quenty/loader": "6.2.1",
33
+ "@quenty/maid": "2.5.0",
34
+ "@quenty/promise": "6.5.0",
35
+ "@quenty/signal": "2.4.0",
36
+ "@quenty/valueobject": "8.0.0-canary.367.e9fdcbc.0"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "d8ad8f8567843d3867b6c06c8c57ec4493672335"
41
+ "gitHead": "e9fdcbc6ea1d46e068bf42a08b833099e9005259"
42
42
  }
@@ -67,20 +67,10 @@ Binder.ClassName = "Binder"
67
67
  function Binder.new(tagName, constructor, ...)
68
68
  local self = setmetatable({}, Binder)
69
69
 
70
- self._maid = Maid.new()
71
- self._tagName = tagName or error("Bad argument 'tagName', expected string")
72
- self._constructor = constructor or error("Bad argument 'constructor', expected table or function")
73
-
74
- self._instToClass = {} -- [inst] = class
75
- self._allClassSet = {} -- [class] = true
76
- self._pendingInstSet = {} -- [inst] = true
77
-
78
- self._listeners = {} -- [inst] = callback
79
- self._args = {...}
70
+ self._tagName = assert(tagName, "Bad argument 'tagName', expected string")
71
+ self._constructor = assert(constructor, "Bad argument 'constructor', expected table or function")
80
72
 
81
- self._maid._warning = task.delay(5, function()
82
- warn(("Binder %q is not loaded. Call :Start() on it!"):format(self._tagName))
83
- end)
73
+ self:Init(...)
84
74
 
85
75
  return self
86
76
  end
@@ -111,6 +101,31 @@ function Binder.isBinder(value)
111
101
  and type(value.Destroy) == "function"
112
102
  end
113
103
 
104
+ --[=[
105
+ Initializes the Binder. Designed to be done via ServiceBag.
106
+
107
+ @param ... any
108
+ ]=]
109
+ function Binder:Init(...)
110
+ if self._initialized then
111
+ return
112
+ end
113
+
114
+ self._initialized = true
115
+ self._maid = Maid.new()
116
+
117
+ self._instToClass = {} -- [inst] = class
118
+ self._allClassSet = {} -- [class] = true
119
+ self._pendingInstSet = {} -- [inst] = true
120
+
121
+ self._listeners = {} -- [inst] = callback
122
+ self._args = {...}
123
+
124
+ self._maid._warning = task.delay(5, function()
125
+ warn(("Binder %q is not loaded. Call :Start() on it!"):format(self._tagName))
126
+ end)
127
+ end
128
+
114
129
  --[=[
115
130
  Listens for new instances and connects to the GetInstanceAddedSignal() and removed signal!
116
131
  ]=]
@@ -117,6 +117,10 @@ function BinderProvider:Init(...)
117
117
 
118
118
  self._initMethod(self, ...)
119
119
 
120
+ for _, binder in pairs(self._binders) do
121
+ binder:Init(...)
122
+ end
123
+
120
124
  self._bindersAddedPromise:Resolve()
121
125
  end
122
126