Skip to content
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

add update & updateList to Enum #7272

Merged
merged 2 commits into from Sep 2, 2020

Conversation

JayceLai
Copy link
Contributor

@JayceLai JayceLai commented Sep 2, 2020

Re: cocos-creator/3d-tasks#4323

Changes:

  • add update & updateList to Enum

Comment on lines 96 to 114
/**
* @param enumDef - the enum type defined from cc.Enum
* @return {Object[]}
*/
Enum.updateList = (enumDef) => {
const enums: any[] = enumDef.__enums__ || [];
enums.length = 0;
// tslint:disable-next-line: forin
for (const name in enumDef) {
const v = enumDef[name];
if (Number.isInteger(v)) {
enums.push({ name, value: v });
}
}
enums.sort((a, b) => a.value - b.value);
enumDef.__enums__ = enums;
return enums;
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall this be removed?

@pandamicro pandamicro merged commit 0192c71 into cocos:3d-v1.2 Sep 2, 2020
@JayceLai JayceLai deleted the add_update_to_Enum branch September 3, 2020 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants