@quenty/binder 4.6.0-canary.241.a4e8214.0 → 4.7.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 +13 -2
- package/package.json +11 -11
- package/src/Shared/BinderProvider.lua +9 -10
- package/src/Shared/BinderProvider.spec.lua +41 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,23 @@
|
|
|
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
|
-
# [4.
|
|
6
|
+
# [4.7.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/binder@4.6.0...@quenty/binder@4.7.0) (2022-01-07)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
|
-
*
|
|
11
|
+
* Binders initialize properly and provider better warnings ([93b6ab1](https://github.com/Quenty/NevermoreEngine/commit/93b6ab1d4f8380124c1a0b3d95b6274c58fd4b30))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [4.6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/binder@4.5.2...@quenty/binder@4.6.0) (2022-01-03)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* Binder.isBinder(binder) does not error on child classes ([76f8bee](https://github.com/Quenty/NevermoreEngine/commit/76f8bee8898bd64c33695f828e64e99567e15abd))
|
|
12
23
|
|
|
13
24
|
|
|
14
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/binder",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.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": "3.
|
|
29
|
-
"@quenty/brio": "3.
|
|
30
|
-
"@quenty/instanceutils": "3.
|
|
31
|
-
"@quenty/linkutils": "3.
|
|
32
|
-
"@quenty/loader": "3.
|
|
33
|
-
"@quenty/maid": "2.0.2",
|
|
34
|
-
"@quenty/promise": "3.
|
|
35
|
-
"@quenty/signal": "2.1.0
|
|
36
|
-
"@quenty/valueobject": "3.
|
|
28
|
+
"@quenty/baseobject": "^3.4.0",
|
|
29
|
+
"@quenty/brio": "^3.7.0",
|
|
30
|
+
"@quenty/instanceutils": "^3.7.0",
|
|
31
|
+
"@quenty/linkutils": "^3.7.0",
|
|
32
|
+
"@quenty/loader": "^3.3.0",
|
|
33
|
+
"@quenty/maid": "^2.0.2",
|
|
34
|
+
"@quenty/promise": "^3.5.0",
|
|
35
|
+
"@quenty/signal": "^2.1.0",
|
|
36
|
+
"@quenty/valueobject": "^3.7.0"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "5a3f3fb6c908fd3874f5ceacc70b404780275119"
|
|
42
42
|
}
|
|
@@ -36,15 +36,9 @@ BinderProvider.__index = BinderProvider
|
|
|
36
36
|
function BinderProvider.new(initMethod)
|
|
37
37
|
local self = setmetatable({}, BinderProvider)
|
|
38
38
|
|
|
39
|
-
-- Pretty sure this is a bad idea
|
|
40
|
-
self._bindersAddedPromise = Promise.new()
|
|
41
|
-
self._startPromise = Promise.new()
|
|
42
|
-
|
|
43
39
|
self._initMethod = initMethod or error("No initMethod")
|
|
44
|
-
|
|
45
40
|
self._initialized = false
|
|
46
41
|
self._started = false
|
|
47
|
-
self._binders = {}
|
|
48
42
|
|
|
49
43
|
return self
|
|
50
44
|
end
|
|
@@ -93,7 +87,13 @@ end
|
|
|
93
87
|
function BinderProvider:Init(...)
|
|
94
88
|
assert(not self._initialized, "Already initialized")
|
|
95
89
|
|
|
90
|
+
self._binders = {}
|
|
96
91
|
self._initialized = true
|
|
92
|
+
|
|
93
|
+
-- Pretty sure this is a bad idea
|
|
94
|
+
self._bindersAddedPromise = Promise.new()
|
|
95
|
+
self._startPromise = Promise.new()
|
|
96
|
+
|
|
97
97
|
self._initMethod(self, ...)
|
|
98
98
|
self._bindersAddedPromise:Resolve()
|
|
99
99
|
end
|
|
@@ -104,7 +104,7 @@ end
|
|
|
104
104
|
@return Promise
|
|
105
105
|
]=]
|
|
106
106
|
function BinderProvider:PromiseBindersAdded()
|
|
107
|
-
return self._bindersAddedPromise
|
|
107
|
+
return assert(self._bindersAddedPromise, "Be sure to require via serviceBag")
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
--[=[
|
|
@@ -113,7 +113,7 @@ end
|
|
|
113
113
|
@return Promise
|
|
114
114
|
]=]
|
|
115
115
|
function BinderProvider:PromiseBindersStarted()
|
|
116
|
-
return self._startPromise
|
|
116
|
+
return assert(self._startPromise, "Be sure to require via serviceBag")
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
--[=[
|
|
@@ -136,8 +136,7 @@ function BinderProvider:__index(index)
|
|
|
136
136
|
return BinderProvider[index]
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
error(("%q Not a valid index"):format(tostring(index)))
|
|
139
|
+
error(("%q Not a valid binder"):format(tostring(index)))
|
|
141
140
|
end
|
|
142
141
|
|
|
143
142
|
--[=[
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
--[[
|
|
2
|
+
@class BinderProvider.spec.lua
|
|
3
|
+
]]
|
|
4
|
+
|
|
5
|
+
local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).load(script)
|
|
6
|
+
|
|
7
|
+
local BinderProvider = require("BinderProvider")
|
|
8
|
+
local Binder = require("Binder")
|
|
9
|
+
|
|
10
|
+
return function()
|
|
11
|
+
describe("BinderProvider.new()", function()
|
|
12
|
+
local provider
|
|
13
|
+
local initialized = false
|
|
14
|
+
|
|
15
|
+
it("should execute immediately", function()
|
|
16
|
+
provider = BinderProvider.new(function(self, arg)
|
|
17
|
+
initialized = true
|
|
18
|
+
assert(arg == 12345, "Bad arg")
|
|
19
|
+
|
|
20
|
+
self:Add(Binder.new("Test", function()
|
|
21
|
+
return { Destroy = function() end; }
|
|
22
|
+
end))
|
|
23
|
+
end)
|
|
24
|
+
|
|
25
|
+
expect(provider).to.be.a("table")
|
|
26
|
+
end)
|
|
27
|
+
|
|
28
|
+
it("should initialize", function()
|
|
29
|
+
expect(initialized).to.equal(false)
|
|
30
|
+
provider:Init(12345)
|
|
31
|
+
expect(initialized).to.equal(true)
|
|
32
|
+
end)
|
|
33
|
+
|
|
34
|
+
it("should contain the binder", function()
|
|
35
|
+
expect(provider.Test).to.be.a("table")
|
|
36
|
+
end)
|
|
37
|
+
|
|
38
|
+
provider:Destroy()
|
|
39
|
+
end)
|
|
40
|
+
|
|
41
|
+
end
|