
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@benev/marduk
Advanced tools
Marduk is a BabylonJS framework for rendering good web games.
npm install @benev/marduk
The theater coordinates your rendering thread and displays the results onto a canvas.
The theater is split into two main parts. Each will live in its own separate bundle.
spec.ts
type, which describes your renderable world
import {AsFigmentSpec} from "@benev/marduk/x/theater/index.pure.js"
export type MySpec = AsFigmentSpec<{
// Describe a renderable object in your world,
// in terms of serializable data.
hippo: {hungry: boolean}
}>
backstage.ts
module (this will be a web worker)
import {MySpec} from "./spec.js"
import {babylonBackstage, theaterWorker} from "@benev/marduk/x/theater/index.babylon.js"
void async function() {
// defining a babylon backstage
// (you could make a backstage for a different kind of renderer)
const backstage = await babylonBackstage<MySpec>(async stagecraft => ({
// now we define a renderer for this object
hippo: (id, data) => {
console.log("spawn", id, data)
return {
update: data => console.log("update", id, data),
dispose: () => console.log("dispose", id, data),
}
},
}))
// establishing the web worker
await theaterWorker(backstage)
}()
backstage.bundle.js
using rollup
, esbuild
, parcel
, vite
, or whateverfrontstage.ts
module (this will be your app's main entrypoint)
import {MySpec} from "./spec.js"
import {Frontstage, register} from "@benev/marduk/x/theater/index.dom.js"
void async function() {
const workerUrl = new URL("./backstage.bundle.js", import.meta.url)
const frontstage = await Frontstage.make<MySpec>({workerUrl})
register(frontstage.getElements())
// okay, now you're ready to manipulate your world
// spawn, then update, then delete a hippo (lol, just to exercise the full lifecycle)
await frontstage.syncFigments([[0, ["hippo", {hungry: false}]]])
await frontstage.syncFigments([[0, ["hippo", {hungry: true}]]])
await frontstage.syncFigments([[0, undefined]])
}()
frontstage.bundle.js
<script type=module src="./frontstage.bundle.js"></script>
<marduk-theater>
element in your html body
<marduk-theater></marduk-theater>
FAQs
babylonjs toolkit
We found that @benev/marduk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.