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

ScriptType handler embed #6148

Closed
wants to merge 6 commits into from
Closed

ScriptType handler embed #6148

wants to merge 6 commits into from

Conversation

kpal81xd
Copy link
Contributor

@kpal81xd kpal81xd commented Mar 12, 2024

Embeds handlers for ScriptType into base class and checks for extended class methods using Object.getPrototypeOf(instance).hasOwnProperty(SCRIPT_<method>)

  • TS linter
  • API reference

N.B

  • handler types are now not optional as there is a base class implementation (will not be called if no override due to hasOwnProperty check on extended class)

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

@kpal81xd kpal81xd marked this pull request as ready for review March 12, 2024 14:41
@kpal81xd kpal81xd requested a review from willeastcott March 12, 2024 14:41
@kpal81xd kpal81xd self-assigned this Mar 12, 2024
@Maksims
Copy link
Collaborator

Maksims commented Mar 12, 2024

How does it handle inheritance?

class Foo extends SctipType {
    initialize() {
        // ...
    }
    update(dt) {
        // ...
    }
}

class Bar extends Foo {
    initialize() {
        super();
        // ...
    }
}

If Bar is added as a script, will it call an update for its instances?

@kpal81xd
Copy link
Contributor Author

kpal81xd commented Mar 14, 2024

How does it handle inheritance?

class Foo extends SctipType {
    initialize() {
        // ...
    }
    update(dt) {
        // ...
    }
}

class Bar extends Foo {
    initialize() {
        super();
        // ...
    }
}

If Bar is added as a script, will it call an update for its instances?

It wont unfortunately so will most likely need to close this PR in the case someone might use this

@kpal81xd kpal81xd closed this Mar 19, 2024
@kpal81xd kpal81xd deleted the types-scripttype branch March 19, 2024 14:44
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.

3 participants