Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Feature Request: Support PixiPlayground Browser Link #4

Open
bigtimebuddy opened this issue Apr 12, 2019 · 4 comments
Open

Feature Request: Support PixiPlayground Browser Link #4

bigtimebuddy opened this issue Apr 12, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@bigtimebuddy
Copy link
Contributor

cc @englercj

Here's an example of JSFiddle POST API for auto-filling:
https://docs.jsfiddle.net/api/display-a-fiddle-from-post

Basically, there are two pieces of information that I post to JSFiddle and CodePen: a snippet of JS code that bootstraps all the plugins, and a list of external resources that are loaded in a specific order. I also set an initial title/description.

This could probably work with PixiPlayground as Settings > Custom URL > External Scripts. And contents to populate the code area.

@bigtimebuddy bigtimebuddy added the enhancement New feature or request label Apr 12, 2019
@englercj
Copy link
Collaborator

I can put something like this together for playground this weekend. Thanks @bigtimebuddy!

@englercj
Copy link
Collaborator

englercj commented Apr 14, 2019

Actually I just realized, you can hit the API to create a new playground just like the app does normally.

I don't have good docs, but here is the handler: https://github.com/englercj/playground/blob/master/server/src/routes/playgrounds.ts#L122

Just make a POST to https://pixiplayground.com/api/playground with JSON data. Something like:

{
    "name": "",
    "description": "",
    "contents": "",
    "author": "",
    "pixiVersion": "",
    "isPublic": true,
    "externaljs": [
        { "url": "" },
        { "url": "" }
    ]
}

Where pixiVersion is the URL to your generated file, and the externaljs array is the list of scripts to load (they will be loaded in order). Only contents and pixiVersion are required.

The API call will return a resolved playground data JSON object which includes the generated slug that you can use to craft the URL the user should navigate to, which is https://pixiplayground.com/#/edit/<slug>.

Does this work?

@bigtimebuddy
Copy link
Contributor Author

What is pixiVersion? The semver? If I provide a version does try to load that bundle?

@englercj
Copy link
Collaborator

englercj commented Apr 14, 2019

pixiVersion can be:

  • "release" which is the latest build on S3 from the release branch
  • Any version tag. "v5.0.0-rc3" for example, which will pull the S3 build for that tag.
  • Any URL to a custom build hosted anywhere (probably needs to be https).

The value here will be loaded first before externaljs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants