@quenty/statestack 3.1.2 → 3.2.1-canary.238.f89c386.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,6 +3,25 @@
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
+ ## [3.2.1-canary.238.f89c386.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/statestack@3.2.0...@quenty/statestack@3.2.1-canary.238.f89c386.0) (2021-12-30)
7
+
8
+ **Note:** Version bump only for package @quenty/statestack
9
+
10
+
11
+
12
+
13
+
14
+ # [3.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/statestack@3.1.2...@quenty/statestack@3.2.0) (2021-11-20)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * Support MacOS syncing ([#225](https://github.com/Quenty/NevermoreEngine/issues/225)) ([03f9183](https://github.com/Quenty/NevermoreEngine/commit/03f918392c6a5bdd33f8a17c38de371d1e06c67a))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [3.1.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/statestack@3.1.1...@quenty/statestack@3.1.2) (2021-10-30)
7
26
 
8
27
  **Note:** Version bump only for package @quenty/statestack
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2014 Quenty
3
+ Copyright (c) 2014-2021 Quenty
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  ## StateStack
2
2
  <div align="center">
3
- <a href="http://quenty.github.io/api/">
4
- <img src="https://img.shields.io/badge/docs-website-green.svg" alt="Documentation" />
3
+ <a href="http://quenty.github.io/NevermoreEngine/">
4
+ <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
5
5
  </a>
6
6
  <a href="https://discord.gg/mhtGUS8">
7
- <img src="https://img.shields.io/badge/discord-nevermore-blue.svg" alt="Discord" />
7
+ <img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
8
8
  </a>
9
9
  <a href="https://github.com/Quenty/NevermoreEngine/actions">
10
10
  <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
@@ -13,6 +13,8 @@
13
13
 
14
14
  Stack of values that allows multiple systems to enable or disable a state
15
15
 
16
+ <div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/StateStack">View docs →</a></div>
17
+
16
18
  ## Installation
17
19
  ```
18
20
  npm install @quenty/statestack --save
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/statestack",
3
- "version": "3.1.2",
3
+ "version": "3.2.1-canary.238.f89c386.0",
4
4
  "description": "Stack of values that allows multiple systems to enable or disable a state",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,11 +25,11 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/baseobject": "^3.1.2",
29
- "@quenty/loader": "^3.1.1"
28
+ "@quenty/baseobject": "3.2.1-canary.238.f89c386.0",
29
+ "@quenty/loader": "3.1.2-canary.238.f89c386.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "e9cd4223c7fda7c852db9743ef844baa19cacb13"
34
+ "gitHead": "f89c3863db94c96adc936ea31a49e0c770756dd0"
35
35
  }
@@ -1,6 +1,25 @@
1
- --- Stack of values that allows multiple systems to enable or disable a state
2
- -- @classmod StateStack
3
- -- @author Quenty
1
+ --[=[
2
+ Stack of values that allows multiple systems to enable or disable a state.
3
+
4
+ ```lua
5
+ local disabledStack = StateStack.new()
6
+ print(disabledStack:GetState()) --> false
7
+
8
+ disabledStack.Changed:Connect(function()
9
+ print("From changed event we have state: ", disabledStack:GetState())
10
+ end)
11
+
12
+ local cancel = disabledStack:PushState() --> From changed event we have state: true
13
+ print(disabledStack:GetState()) --> true
14
+
15
+ cancel() --> From changed event we have state: true
16
+ print(disabledStack:GetState()) --> false
17
+
18
+ disabledStack:Destroy()
19
+ ```
20
+
21
+ @class StateStack
22
+ ]=]
4
23
 
5
24
  local require = require(script.Parent.loader).load(script)
6
25
 
@@ -10,6 +29,10 @@ local StateStack = setmetatable({}, BaseObject)
10
29
  StateStack.ClassName = "StateStack"
11
30
  StateStack.__index = StateStack
12
31
 
32
+ --[=[
33
+ Constructs a new StateStack.
34
+ @return StateStack
35
+ ]=]
13
36
  function StateStack.new()
14
37
  local self = setmetatable(BaseObject.new(), StateStack)
15
38
 
@@ -19,15 +42,28 @@ function StateStack.new()
19
42
 
20
43
  self._stateStack = {}
21
44
 
22
- self.Changed = self._state.Changed -- :Fire(newState)
45
+ --[=[
46
+ Fires with the new state
47
+ @prop Changed Signal<boolean>
48
+ @within StateStack
49
+ ]=]
50
+ self.Changed = self._state.Changed
23
51
 
24
52
  return self
25
53
  end
26
54
 
55
+ --[=[
56
+ Gets the current state
57
+ @return boolean
58
+ ]=]
27
59
  function StateStack:GetState()
28
60
  return self._state.Value
29
61
  end
30
62
 
63
+ --[=[
64
+ Pushes the current state onto the stack
65
+ @return function -- Cleanup function to invoke
66
+ ]=]
31
67
  function StateStack:PushState()
32
68
  local data = {}
33
69
  table.insert(self._stateStack, data)
@@ -55,4 +91,14 @@ function StateStack:_updateState()
55
91
  self._state.Value = next(self._stateStack) ~= nil
56
92
  end
57
93
 
94
+ --[=[
95
+ Cleans up the StateStack and sets the metatable to nil.
96
+
97
+ :::tip
98
+ Be sure to call this to clean up the state stack!
99
+ :::
100
+ @method Destroy
101
+ @within StateStack
102
+ ]=]
103
+
58
104
  return StateStack
@@ -2,6 +2,6 @@
2
2
  "name": "node_modules",
3
3
  "globIgnorePaths": [ "**/.package-lock.json" ],
4
4
  "tree": {
5
- "$path": { "optional": "..\\node_modules" }
5
+ "$path": { "optional": "../node_modules" }
6
6
  }
7
7
  }