Skip to content

Commit

Permalink
Merge pull request #25 from eaglerforge/main
Browse files Browse the repository at this point in the history
v2.1
  • Loading branch information
ZXMushroom63 authored Oct 18, 2024
2 parents e94c747 + f514406 commit aa53a8b
Show file tree
Hide file tree
Showing 22 changed files with 295 additions and 872 deletions.
11 changes: 11 additions & 0 deletions docs/apidoc/promisify.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,15 @@ ModAPI.addEventListener("sendchatmessage", function downloadSomething(e) {
});
```

The way this promisify method works is by taking in a java method, and (effectively) converting it into a javascript async function.
For example, you can do:
```javascript
var asyncDownloadRemoteURI = ModAPI.promisify(ModAPI.hooks.methods.nlevi_PlatformRuntime_downloadRemoteURI);

console.log(typeof asyncDownloadRemoteURI); //Logs function
```

When it is called, like any other asyncronoush function, it returns a `Promise` object.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

You can replace the argument with any other method or constructor, including non asynchronous ones.
174 changes: 0 additions & 174 deletions examplemods/astar.js

This file was deleted.

80 changes: 0 additions & 80 deletions examplemods/defunct/advanced_vclip.js

This file was deleted.

98 changes: 0 additions & 98 deletions examplemods/defunct/blocklook.js

This file was deleted.

2 changes: 1 addition & 1 deletion examplemods/grapplehook.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
GrappleHookPlugin.prev = "GROUND";//Update state
}
});
});
})();
Loading

0 comments on commit aa53a8b

Please sign in to comment.