@quenty/playerthumbnailutils 3.1.2 → 3.3.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,28 @@
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.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerthumbnailutils@3.2.0...@quenty/playerthumbnailutils@3.3.0) (2021-12-14)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add PlayerThumbnailUtils.promiseUserName(userId) ([42a2ed7](https://github.com/Quenty/NevermoreEngine/commit/42a2ed77649d397f37e8d7eb6f20e9e3f77ec5f8))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerthumbnailutils@3.1.2...@quenty/playerthumbnailutils@3.2.0) (2021-11-20)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * Support MacOS syncing ([#225](https://github.com/Quenty/NevermoreEngine/issues/225)) ([03f9183](https://github.com/Quenty/NevermoreEngine/commit/03f918392c6a5bdd33f8a17c38de371d1e06c67a))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [3.1.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerthumbnailutils@3.1.1...@quenty/playerthumbnailutils@3.1.2) (2021-10-30)
7
29
 
8
30
  **Note:** Version bump only for package @quenty/playerthumbnailutils
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/playerthumbnailutils",
3
- "version": "3.1.2",
3
+ "version": "3.3.0",
4
4
  "description": "Reimplementation of Player:GetUserThumbnailAsync but as a promise with retry logic",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -26,10 +26,10 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@quenty/loader": "^3.1.1",
29
- "@quenty/promise": "^3.1.2"
29
+ "@quenty/promise": "^3.2.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "e9cd4223c7fda7c852db9743ef844baa19cacb13"
34
+ "gitHead": "8a33939501e25cf227e96f7eb0d1a23b86f10f3c"
35
35
  }
@@ -44,4 +44,34 @@ function PlayerThumbnailUtils.promiseUserThumbnail(userId, thumbnailType, thumbn
44
44
  return promise
45
45
  end
46
46
 
47
+ function PlayerThumbnailUtils.promiseUserName(userId)
48
+ assert(type(userId) == "number", "Bad userId")
49
+
50
+ local promise
51
+ promise = Promise.spawn(function(resolve, reject)
52
+ local tries = 0
53
+ repeat
54
+ tries = tries + 1
55
+ local name
56
+ local ok, err = pcall(function()
57
+ name = Players:GetNameFromUserIdAsync(userId)
58
+ end)
59
+
60
+ -- Don't retry if we immediately error (timeout exceptions!)
61
+ if not ok then
62
+ return reject(err)
63
+ end
64
+
65
+ if type(name) == "string" then
66
+ return resolve(name)
67
+ else
68
+ task.wait(0.05)
69
+ end
70
+ until tries >= MAX_TRIES or (not promise:IsPending())
71
+ reject()
72
+ end)
73
+
74
+ return promise
75
+ end
76
+
47
77
  return PlayerThumbnailUtils
@@ -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
  }