@rbxts/app-forge 0.3.8 → 0.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.
@@ -31,6 +31,10 @@ do
31
31
  if not (name ~= "" and name) then
32
32
  error("App name is required in Args constructor")
33
33
  end
34
+ local bind = forge:getBind(name)
35
+ if not bind then
36
+ error("FAILED TO GET BIND FOR APP!")
37
+ end
34
38
  local px = usePx(target)
35
39
  self.forge = forge
36
40
  local _object = table.clone(props.props)
@@ -38,7 +42,7 @@ do
38
42
  _object.px = px
39
43
  self.props = _object
40
44
  self.name = name
41
- self.bind = forge:getBind(name)
45
+ self.bind = bind
42
46
  self.state = self.bind:getValue()
43
47
  end
44
48
  end
package/out/index.d.ts CHANGED
@@ -5,8 +5,8 @@ export default class AppForge {
5
5
  binds: Map<string, [React.Binding<boolean>, (T: boolean) => void]>;
6
6
  loaded: Map<string, React.Element<any, string | React.JSXElementConstructor<any>>>;
7
7
  private rulesManager;
8
- getBind(name: AppNames[number]): React.Binding<boolean>;
9
- getState(name: AppNames[number]): boolean;
8
+ getBind(name: AppNames[number]): React.Binding<boolean> | undefined;
9
+ getState(name: AppNames[number]): boolean | undefined;
10
10
  set(name: AppNames[number], value: boolean): void;
11
11
  open(name: AppNames[number]): void;
12
12
  close(name: AppNames[number]): void;
package/out/init.luau CHANGED
@@ -12,6 +12,7 @@ local App = _decorator.App
12
12
  local AppContainer = TS.import(script, script, "container").AppContainer
13
13
  -- Classes
14
14
  local RulesManager = TS.import(script, script, "rules").default
15
+ local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
15
16
  local AppForge
16
17
  do
17
18
  AppForge = setmetatable({}, {
@@ -30,6 +31,9 @@ do
30
31
  self.rulesManager = RulesManager.new(self)
31
32
  end
32
33
  function AppForge:getBind(name)
34
+ if not RunService:IsRunning() then
35
+ return nil
36
+ end
33
37
  local _binds = self.binds
34
38
  local _name = name
35
39
  if not (_binds[_name] ~= nil) then
@@ -40,7 +44,11 @@ do
40
44
  return _binds_1[_name_1][1]
41
45
  end
42
46
  function AppForge:getState(name)
43
- return self:getBind(name):getValue()
47
+ local _result = self:getBind(name)
48
+ if _result ~= nil then
49
+ _result = _result:getValue()
50
+ end
51
+ return _result
44
52
  end
45
53
  function AppForge:set(name, value)
46
54
  if not self.rulesManager:applyRules(name, value) then
package/out/rules.luau CHANGED
@@ -49,13 +49,7 @@ do
49
49
  local allNames = Object.keys(AppRegistry)
50
50
  -- ▼ ReadonlyArray.forEach ▼
51
51
  local _callback = function(n)
52
- local _condition = not (n ~= "" and n) or n == name
53
- if not _condition then
54
- local _loaded = self.appManager.loaded
55
- local _n = n
56
- _condition = not _loaded[_n]
57
- end
58
- if _condition then
52
+ if not (n ~= "" and n) or n == name then
59
53
  return nil
60
54
  end
61
55
  local _n = n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/app-forge",
3
- "version": "0.3.8",
3
+ "version": "0.4.0",
4
4
  "description": "An App Manager for react",
5
5
  "main": "out/init.lua",
6
6
  "packageManager": "bun@1.3.1",