Skip to content

Commit

Permalink
Cc/fix tests (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherChudzicki authored Dec 27, 2022
1 parent ca1c5a7 commit 549f4e6
Show file tree
Hide file tree
Showing 43 changed files with 7,470 additions and 15,546 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
},
rules: {
"no-var": "warn",
"no-unused-vars": [1, { argsIgnorePattern: "^_" }],
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"no-multi-str": 1,
"prefer-const": "warn"
},
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Tests

on:
pull_request:
push:
branches: [master]

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- run: npm ci --include=dev
- run: npm run lint
- run: npm test
- run: npm run build
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
node_modules
build
build
build_tests
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,29 @@ Examples:
- [WebGL + CSS 3D](http://acko.net/files/threestrap/multiple_renderers.html)
- [VR + Controls](http://acko.net/files/threestrap/vr2.html)

# Usage
## Usage

Install via npm:

```
```sh
npm install threestrap
```

Add `build/threestrap.js` to your Three.js:

```html
<!--
Or use CDNs like
https://cdn.jsdelivr.net/npm/[email protected]/build/three.js
-->
<script src="three.js"></script>
<script src="threestrap.js"></script>
```

Get a threestrap context:

```javascript
var three = new Threestrap.Bootstrap();
const three = new Threestrap.Bootstrap();
```

This will create a full-page Three.js WebGL canvas, initialize the scene and
Expand All @@ -48,7 +52,7 @@ the `three` context:

```javascript
// Insert a cube
var mesh = new THREE.Mesh(
const mesh = new THREE.Mesh(
new THREE.CubeGeometry(0.5, 0.5, 0.5),
new THREE.MeshNormalMaterial()
);
Expand Down Expand Up @@ -135,11 +139,6 @@ When `init` is set to false, initialization only happens when manually calling
Plugins can make objects and methods available on the threestrap context, like
`three.Time.now` or `three.Loop.start()`.

## Builds

- threestrap.js: Full build (but still requires three.js)
- threestrap-core.js: Core only, requires three.js + lodash
- threestrap-extra.js: Extra plugins

## Plugins

Expand All @@ -149,7 +148,7 @@ installed in the given order.
Plug-in specific options are grouped under the plug-in's name:

```javascript
var three = new Threestrap.Bootstrap({
const three = new Threestrap.Bootstrap({
plugins: ["core", "stats"],
size: {
width: 1280,
Expand Down Expand Up @@ -185,7 +184,7 @@ three.off("event", handler);
You can also bind events directly to object methods using `.bind`:

```javascript
var object = {
const object = {
render: function (event, three) {},
yup: function (event, three) {},
redraw: function (event, three) {},
Expand Down
Loading

0 comments on commit 549f4e6

Please sign in to comment.