mirror of
https://github.com/AmberGraceRblx/luau-promise.git
synced 2025-04-24 15:50:01 +00:00
Switch type marker to be a special symbol, so it's less likely to conflict
This commit is contained in:
parent
9bda3e68ea
commit
23a3b629d6
1 changed files with 4 additions and 2 deletions
|
@ -74,6 +74,8 @@ local function createSymbol(name)
|
|||
return symbol
|
||||
end
|
||||
|
||||
local PromiseMarker = createSymbol("PromiseMarker")
|
||||
|
||||
local Promise = {}
|
||||
Promise.prototype = {}
|
||||
Promise.__index = Promise.prototype
|
||||
|
@ -114,7 +116,7 @@ function Promise.new(callback)
|
|||
_source = debug.traceback(),
|
||||
|
||||
-- A tag to identify us as a promise
|
||||
_type = "Promise",
|
||||
[PromiseMarker] = true,
|
||||
|
||||
_status = Promise.Status.Started,
|
||||
|
||||
|
@ -245,7 +247,7 @@ function Promise.is(object)
|
|||
return false
|
||||
end
|
||||
|
||||
return object._type == "Promise"
|
||||
return object[PromiseMarker] == true
|
||||
end
|
||||
|
||||
function Promise.prototype:getStatus()
|
||||
|
|
Loading…
Reference in a new issue