Skip to content

Commit

Permalink
Fix loading of existing snippet not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Popov72 committed Sep 4, 2023
1 parent c4d883a commit d566e4e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/dataExport.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './fileSaver.js';

const snippetUrl = "https://snippet.babylonjs.com";
export const snippetUrl = "https://snippet.babylonjs.com";

let currentSnippetToken;

Expand Down
4 changes: 2 additions & 2 deletions src/hashUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function cleanHash() {
location.hash = splits.join("#");
}

export function checkHash() {
export function checkHash(snippetUrl, vertexEditor, pixelEditor, selectMesh, compile) {
if (location.hash) {
if (previousHash != location.hash) {
cleanHash();
Expand Down Expand Up @@ -53,5 +53,5 @@ export function checkHash() {
}
}

setTimeout(checkHash, 200);
setTimeout(checkHash.bind(checkHash, snippetUrl, vertexEditor, pixelEditor, selectMesh), 200);
}
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { loadShader } from './shaders.js';
import { checkHash } from './hashUtils.js';
import { saveFunction, getZip } from './dataExport.js';
import { saveFunction, getZip, snippetUrl } from './dataExport.js';


let engine;
Expand Down Expand Up @@ -234,9 +234,9 @@ async function createEngine(canvas) {
(function () {
document.addEventListener("DOMContentLoaded", start, false);

function start() {
effectiveStart();
checkHash();
async function start() {
await effectiveStart();
checkHash(snippetUrl, vertexEditor, pixelEditor, selectMesh, compile);
}

async function effectiveStart() {
Expand Down

0 comments on commit d566e4e

Please sign in to comment.