mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-19 01:59:48 -05:00
basic ts-standard linting
This commit is contained in:
5 files changed
+20
-19
No files matched your search
@@ -13,7 +13,7 @@ import StimulusReflex from 'stimulus_reflex'
|
||||
* Learn more at: https://docs.stimulusreflex.com
|
||||
*/
|
||||
export default class extends Controller {
|
||||
connect () {
|
||||
connect (): void {
|
||||
StimulusReflex.register(this)
|
||||
}
|
||||
|
||||
@@ -34,27 +34,27 @@ export default class extends Controller {
|
||||
* reflexId - a UUID4 or developer-provided unique identifier for each Reflex
|
||||
*/
|
||||
|
||||
beforeReflex (element, reflex, noop, reflexId) {
|
||||
beforeReflex (element, reflex, noop, reflexId): void {
|
||||
// document.body.classList.add('wait')
|
||||
}
|
||||
|
||||
reflexSuccess (element, reflex, noop, reflexId) {
|
||||
reflexSuccess (element, reflex, noop, reflexId): void {
|
||||
// show success message
|
||||
}
|
||||
|
||||
reflexError (element, reflex, error, reflexId) {
|
||||
reflexError (element, reflex, error, reflexId): void {
|
||||
// show error message
|
||||
}
|
||||
|
||||
reflexHalted (element, reflex, error, reflexId) {
|
||||
reflexHalted (element, reflex, error, reflexId): void {
|
||||
// handle aborted Reflex action
|
||||
}
|
||||
|
||||
afterReflex (element, reflex, noop, reflexId) {
|
||||
afterReflex (element, reflex, noop, reflexId): void {
|
||||
// document.body.classList.remove('wait')
|
||||
}
|
||||
|
||||
finalizeReflex (element, reflex, noop, reflexId) {
|
||||
finalizeReflex (element, reflex, noop, reflexId): void {
|
||||
// all operations have completed, animation etc is now safe
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ export default class extends ApplicationController {
|
||||
* call super if you intend to do anything else when this controller connects.
|
||||
*/
|
||||
|
||||
connect () {
|
||||
connect (): void {
|
||||
super.connect()
|
||||
// add your code here, if applicable
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import { Controller } from 'stimulus'
|
||||
export default class extends Controller {
|
||||
static targets = ['output']
|
||||
|
||||
connect () {
|
||||
connect (): void {
|
||||
this.outputTarget.textContent = 'Hello, Stimulus!'
|
||||
}
|
||||
}
|
||||
@@ -12,15 +12,15 @@ class PartPreview {
|
||||
observer.observe(canvas)
|
||||
}
|
||||
|
||||
setup () {
|
||||
setup (): void {
|
||||
this.scene = new THREE.Scene()
|
||||
this.renderer = new THREE.WebGLRenderer({ canvas: this.canvas })
|
||||
this.camera = new THREE.PerspectiveCamera(45, this.canvas.width / this.canvas.height, 0.1, 1000)
|
||||
this.camera.position.z = 50
|
||||
}
|
||||
|
||||
onIntersectionChanged (entries, observer) {
|
||||
if (entries[0].isIntersecting) {
|
||||
onIntersectionChanged (entries, observer): void {
|
||||
if (entries[0].isIntersecting === true) {
|
||||
this.setup()
|
||||
this.load(this.url, this.format)
|
||||
} else {
|
||||
@@ -28,7 +28,7 @@ class PartPreview {
|
||||
}
|
||||
}
|
||||
|
||||
load (url, format) {
|
||||
load (url, format): void {
|
||||
let loader = null
|
||||
if (format === 'obj') { loader = new OBJLoader() } else if (format === 'stl') { loader = new STLLoader() }
|
||||
|
||||
@@ -39,7 +39,7 @@ class PartPreview {
|
||||
)
|
||||
}
|
||||
|
||||
onLoad (model) {
|
||||
onLoad (model): void {
|
||||
const material = new THREE.MeshNormalMaterial({
|
||||
flatShading: true
|
||||
})
|
||||
@@ -85,19 +85,19 @@ class PartPreview {
|
||||
this.animate()
|
||||
}
|
||||
|
||||
onLoadError (error) {
|
||||
onLoadError (error): void {
|
||||
console.error(error)
|
||||
}
|
||||
|
||||
animate () {
|
||||
animate (): void {
|
||||
this.scene.rotation.y = Date.now() / 1800
|
||||
this.renderer.render(this.scene, this.camera)
|
||||
this.frame = window.requestAnimationFrame(this.animate.bind(this))
|
||||
}
|
||||
|
||||
cleanup () {
|
||||
cleanup (): void {
|
||||
window.cancelAnimationFrame(this.frame)
|
||||
if (this.scene) {
|
||||
if (this.scene !== null) {
|
||||
this.scene.traverse(function (node) {
|
||||
if (node instanceof THREE.Mesh) {
|
||||
node.geometry.dispose()
|
||||
@@ -105,7 +105,7 @@ class PartPreview {
|
||||
}
|
||||
})
|
||||
}
|
||||
if (this.renderer) {
|
||||
if (this.renderer !== null) {
|
||||
this.renderer.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"*": ["node_modules/*", "app/javascript/*"]
|
||||
},
|
||||
"sourceMap": true,
|
||||
"strictNullChecks": true,
|
||||
"target": "es5",
|
||||
"noEmit": true
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user