Create an entrypoint for just folding API#750
Create an entrypoint for just folding API#750guyguy2001 wants to merge 3 commits intorefactor/extract-scripting-apifrom
Conversation
| <script src="./frontend/jscripts/jquery/jquery-1.7.2.min.js"></script> | ||
| <script src="./frontend/jscripts/jquery/jquery-unselectable.js"></script> | ||
| <script src="./frontend/jscripts/jquery-ui/jquery-ui-1.8.7.custom.min.js"></script> | ||
| <script src="./frontend/jscripts/json/json2.js"></script> | ||
|
|
||
| <script src="./frontend/jscripts/application.js"></script> | ||
| <script src="./frontend/jscripts/utils.js"></script> | ||
| <script src="./frontend/jscripts/ajaxmanager.js"></script> | ||
| <script src="./frontend/jscripts/datamanager.js"></script> | ||
| <script src="./frontend/jscripts/usermanager.js"></script> | ||
|
|
||
| <script src="./frontend/jscripts/eterna/eterna-application.js"></script> | ||
| <script src="./frontend/jscripts/eterna/eterna-utils.js"></script> | ||
| <script src="./frontend/jscripts/eterna/script-library.js"></script> | ||
| <script src="./frontend/jscripts/eterna/script-interface.js"></script> | ||
| <script src="./frontend/jscripts/eterna/presenter.js"></script> |
There was a problem hiding this comment.
I'm not sure which of these is necessary - I would rather not have all of them in the script editor
| FoldingAPIApp: typeof FoldingAPIApp; | ||
| app: EternaApp; // this syntax is used in index.html.tmpl, at least... | ||
| __PIXI_APP__?: PIXI.Application; | ||
| } | ||
| } | ||
|
|
||
| window.EternaApp = EternaApp; | ||
| window.FoldingAPIApp = FoldingAPIApp; |
There was a problem hiding this comment.
Ideally I'd use a different index.ts for folding-api.html, so that we don't have to import pixi in the script editor - I'm not sure what is the relationship between eterna/index.ts and index.html though.
48fedc4 to
228cd42
Compare
|
|
||
| public async run(): Promise<void> { | ||
| if (!FoldingAPIApp.isWebAssemblySupported()) { | ||
| throw new WasmNotSupportedError( |
There was a problem hiding this comment.
I decided to leave handling this error to the Vue app trying to import it. Does it make sense?
Currently it wouldn't propagate to the vue app because of how I used it in folding-api.html.tmpl
| log.info('Initializing folding engines...'); | ||
| console.time('Test'); | ||
| const folders: (Folder | null)[] = await Promise.all([ | ||
| Vienna.create(), |
There was a problem hiding this comment.
Folders duplication with EternaApp.ts - I should probably move this to a LoadAllFolders.ts thing, so that new folders wouldn't be missed
## Summary This is part of the process of extracting the script-facing API from PoseEditMode in order to make it usable for non-booster scripts. Replaces #749 ## Implementation Notes I did it like the previous PR, except I didn't implement get_folder/select_folder, since they are behind a "lock", and I didn't want to think yet of whether or not I want the extracted logic to inherit the lock. However, while get_folder is locked, the calculation functions (such as `fold`) which also access the folder, aren't locked (even on `dev`). Is this intended? ## Testing I ran https://eternagame.org/scripts/13774466, and it passed. The script checks that all of the extracted functions (expect folding with binding sites) work and return the same values. This is an unrelated issue, but : For some reason, both on main/master (https://eternagame.org/puzzles/6096060/play) and on my branch, the first time I run it I get the following errors, and on future runs it passes. Reloading the page makes the issue appear again for a single execution. Errors:  Successful run:  (In my branch I just copy pasted the script, since I didn't have it on eternadev.org, and changed `Lib.fold`->`applet.fold`. I shouldn't have Lib in the terminal, right?) ## Related Issues Enables eternagame/eternagame.org#378, #750
Summary
TODO
Implementation Notes
Currently I provide an html entrypoint containing a
maingameelement which has the same external folding API as the mainmaingameobject used in the regular eterna puzzles.This is stacked on top of #749 ! change this to point to
devafter merging #749 and before merging this.Testing
I ran the following in the terminal:
Related Issues
A per-requesit of eternagame/eternagame.org#378
Stacked on top of #749