修改 messageFlag 格式避免与其他页面代码衝突 #561
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
現在使用
用
randomString(16)
這個雖然達到 41^16 (6.376 * 10^25) 個組合,但鍵都是英文字,而且執行時要運用new Array loop 等方式,效率低
新寫法是利用
.toString(36)
直接轉換,效率高採用 "-xxxxxxxx.xxxxxxxx" 格式,不容易引起衝突(例如頁面本身也使用 XXXXXXXXXXXXXXXX 這種鍵)
而且沙盒內的全域變數生成/刪除也不能改 "-" 開首的
Date.now()
是递增特性。後面的randNum(8e11, 2e12)
能產生一個不易重覆的8位字串 (1.2 x 10^12 組合)。