cocos / cocos-engine Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved type array to get the name of the code #5780
Conversation
let type = value.constructor.name; | ||
if (!type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS下不能赋值name,能直接用defineProperty设置的吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
通过测试 defineProperty 也无法设置
else if (constructor === Uint32Array) { return 'Uint32Array'; } | ||
else if (constructor === Int32Array) { return 'Int32Array'; } | ||
else if (constructor === Uint8Array) { return 'Uint8Array'; } | ||
return ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
都不是的话,抛出个异常吧
!Int32Array.name && (Int32Array.name = 'Int32Array'); | ||
|
||
!Uint8Array.name && (Uint8Array.name = 'Uint8Array'); | ||
!Uint16Array.name && (Uint8Array.name = 'Uint16Array'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
game over
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修改了
Re: cocos-creator/2d-tasks#
Changes:
原因:由于之前为了处理 ie 上 TypeArray 获取到 name 为空的问题,在代码中设置了 TypeArray 的 name,但是 ios9 系统 name 是只读的属性如果设置的话就会报错,从而导致引擎代码跑在 ios9 系统上会崩溃