wolf-ecs-system-transform
v0.1.0
Published
A Babel plugin to inline and optimise [WolfECS](https://github.com/EnderShadow8/wolf-ecs) query iteration.
Downloads
1
Readme
wolf-ecs-query-inline
A Babel plugin to inline and optimise WolfECS query iteration.
Usage
Install Babel first if you haven't already:
npm i @babel/cli @babel/core -D
Install the plugin:
npm i wolf-ecs-query-inline
Add the plugin to your babel.config.json
:
{
"plugins": [
"wolf-ecs-query-inline"
]
}
More info on Babel config here.
Finally, replace any instances of query.forEach
you want to inline with query._forEach
. This is to prevent name collisions with other functions such as Array.prototype.forEach
.
Caveats
return
is not yet supported.- The argument passed to
_forEach
must be a function expression. (function() {}
or() => {}
) - Arrow functions must have braces.
_forEach
can't be used as a method name elsewhere, otherwise it will also be mistakenly compiled into a query iteration loop.