-
Notifications
You must be signed in to change notification settings - Fork 11
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
Create an entrypoint for just folding API #750
base: refactor/extract-scripting-api
Are you sure you want to change the base?
Create an entrypoint for just folding API #750
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: ![image](https://github.com/user-attachments/assets/1fca8f90-85f4-485c-9ff4-a44fcdb2445a) Successful run: ![image](https://github.com/user-attachments/assets/ecfe8020-2724-44f3-819f-0a6c13182786) (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
maingame
element which has the same external folding API as the mainmaingame
object used in the regular eterna puzzles.This is stacked on top of #749 ! change this to point to
dev
after 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