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

Adds Support for Enum refs #15

Merged
merged 5 commits into from
Sep 18, 2024
Merged

Adds Support for Enum refs #15

merged 5 commits into from
Sep 18, 2024

Conversation

marklundin
Copy link
Member

Adds support for enum attributes by reference. Fixes #12 .

Both the following using literal and reference are now supported. Tests updated to include both use cases.

import { Script } from 'playcanvas'

/** @enum {number} */
const Lights = {
    ON: 1,
    OFF: 0,
    UNKNOWN: 0.5
}

class Hack extends Script {
    /**
     * @attribute
     * @type {Lights}
     */
    ambient = Lights.OFF
    
    /**
     * @attribute
     * @type {Lights}
     */
    spec = 0
}

export { Hack };

@marklundin marklundin added the enhancement New feature or request label Sep 18, 2024
@marklundin marklundin self-assigned this Sep 18, 2024
@marklundin marklundin merged commit dc778d5 into main Sep 18, 2024
1 check passed
@marklundin marklundin deleted the fix-enum branch September 18, 2024 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enum constants not evaluated
2 participants