newgrounds-boom
Version:
Newgrounds.io plugin for Kaboom
32 lines (29 loc) • 843 B
text/typescript
import { KaboomCtx } from "kaboom";
import { NewgroundsPlugin } from "./types";
import ng from "newgrounds.js";
export function newgroundsPlugin(k: KaboomCtx): NewgroundsPlugin {
return {
ngConnect(id: string, cipher: string, debug: boolean) {
// @ts-ignore
ng.connect(id, cipher, {
debug,
});
},
ngUnlockMedal(id: number) {
ng.unlockMedal(id);
},
ngPostScore(id: number, value: number) {
ng.postScore(id, value);
},
ngUsername() {
return ng.getUsername();
},
ngVersion() {
return ng.getVersion();
},
ngIsSupporter() {
return Boolean(ng.isSupporter());
},
};
}
export default newgroundsPlugin;