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

[low severity] toJSON API incompatible warning #225

Open
FurryR opened this issue Sep 23, 2024 · 2 comments
Open

[low severity] toJSON API incompatible warning #225

FurryR opened this issue Sep 23, 2024 · 2 comments

Comments

@FurryR
Copy link

FurryR commented Sep 23, 2024

toJSON (optTargetId, serializationOptions) {

Conflicts with:

92c53a5

Which may cause some programs break.

Possible solution:

    /**
     * Export project or sprite as a Scratch 3.0 JSON representation.
     * @param {*} optSerializationOptions Optional id of a sprite to serialize, or the serialization option
     * @param {*} optCompatibleOptions Compatible serialization option
     * @return {string} Serialized state of the runtime.
     */
    toJSON (optSerializationOptions, optCompatibleOptions) {
        const sb3 = require('./serialization/sb3');
        let serializationOptions = optSerializationOptions;
        let targetId;
        if (typeof optSerializationOptions === 'string') {
           serializationOptions = optCompatibleOptions;
           targetId = optSerializationOptions;
        } else {
           serializationOptions = optSerializationOptions;
           if (typeof serializationOptions === 'object' && serializationOptions) targetId = serializationOptions.targetId;
        }
        return StringUtil.stringify(sb3.serialize(this.runtime, targetId, serializationOptions);
    }
@FurryR FurryR changed the title [low severity] serializationOptions should be optional (optSerializationOptions) [low severity] toJSON API incompatible warning Sep 23, 2024
@GarboMuffin
Copy link
Member

do you have any examples of code that is actually broken right now that should work

@FurryR
Copy link
Author

FurryR commented Sep 27, 2024

do you have any examples of code that is actually broken right now that should work

The issue mirrors from Gandi IDE's collaboration system (didn't confirm anything else broken). As it's marked as low severity, you could close this issue safely if you want.

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

No branches or pull requests

2 participants