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

use html5 history API instead of hash #101

Open
therewasaguy opened this issue Jan 9, 2016 · 1 comment
Open

use html5 history API instead of hash #101

therewasaguy opened this issue Jan 9, 2016 · 1 comment

Comments

@therewasaguy
Copy link
Owner

we've been using hash to load sketches without refreshing the page like this:

http://p5ide.herokuapp.com/editor#?sketch=568d9514f60b940300d5f2fd

@antiboredom suggests we use HTML History API instead like this http://p5ide.herokuapp.com/editor/sketch/568d9514f60b940300d5f2fd

because

  1. the url looks nicer, and
  2. it may help with Upload "assets" (i.e. JSON, Images, Audio, Video, text files) #100, to loading files by relative paths in methods like loadJSON('data.json'). If we the server gets a request from http://p5ide.herokuapp.com/editor/sketch/568d9514f60b940300d5f2fd/assets/myimage.jpg we could see that the request is for that particular project, and return the image associated with that project that has that name.

To accomplish this, we can incorporate the vue-router module which we have not started using yet (it may not have been finished when the project began): http://vuejs.github.io/vue-router/en/api/properties.html

@therewasaguy
Copy link
Owner Author

As part of this, it might be good to revisit the url structure projects. There are currently a few ways to "view" projects.

  • /editor?sketch=projectID - editor window
  • /view?sketch=projectID - full page link to a saved project. Finds all the files related to the project, parses and builds the index.html page on the server-side.
  • /sketch/output.html - the iframe inside of /editor. All sketch code is injected client-side before (re)loading. Currently served static, but this may need to change (see notify if offline & allow sketches to keep running #99). This is similar to /preview (below), but adds a script to send messages from the iframe's console to the virtual debugging console.
  • /preview - for "preview in new window". Gets all file data from local storage, so we haven't been storing the projectID in the url.

I think the last 2 paths would need to include projectID in order to load assets with relative path (#100 (comment))

So maybe these could be the paths:
/editor/username/projectID
/view/username/projectID
/preview/projectID
/frameview/projectID

I think it's faster for MongoDB to find projects by ID than by name, though name is obviously friendlier.

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

1 participant