Leo*_*ang 18 javascript immutable.js
我正在浏览Immutable.js的源代码,并且有一个ownerID我不理解的字段.
下面是源Map.asMutable()和Map.asImmutable():https://github.com/facebook/immutable-js/blob/master/src/Map.js#L171
似乎可变对象和不可变对象之间的唯一区别是它们的ownerIDs.什么是ownerID它用于什么?
如果您追溯该财产:
L#14:
import { DELETE, SHIFT, SIZE, MASK, NOT_SET, CHANGE_LENGTH, DID_ALTER, OwnerID,
MakeRef, SetRef, arrCopy } from './TrieUtils'
Run Code Online (Sandbox Code Playgroud)
在src/TrieUtils.js中:
L#36:
// A function which returns a value representing an "owner" for transient writes
// to tries. The return value will only ever equal itself, and will not equal
// the return of any subsequent call of this function.
export function OwnerID() {}
Run Code Online (Sandbox Code Playgroud)
这是他们创建的一些属性,例如哈希值来代表虚拟所有者。
| 归档时间: |
|
| 查看次数: |
1729 次 |
| 最近记录: |