Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: types ARButton and VRButton #28

Closed
wants to merge 3 commits into from

Conversation

DylanTackoor
Copy link
Contributor

What

  • ARButton.js -> ARButton.ts
  • VRButton.js -> VRButton.ts

Why

Types XRButtons. Didn't see an issue tracking these in any of the typing milestones so no worries if it's too early to merge this. Just wanted to fix something inbetween working on typing the loaders as they're taking a while.

Checklist

  • Ready to be merged

ARButton.js -> ARButton.ts

removes ARButton.js

adds return types
@joshuaellis joshuaellis added this to the TS Transition stage 3 milestone Mar 8, 2021
Copy link
Member

@joshuaellis joshuaellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few discussion points, nothing major imo

@@ -1,28 +1,37 @@
import { WebGLRenderer, XRSession, XRSessionInit } from 'three'

interface ARButtonSessionInit extends XRSessionInit {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets export this type, even if no one uses it, we might aswell.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do!

@@ -79,7 +88,8 @@ class ARButton {

button.onclick = function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we could use addEventListener instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, I'll convert it the morning 😃

@@ -79,7 +88,8 @@ class ARButton {

button.onclick = function () {
if (currentSession === null) {
navigator.xr.requestSession('immersive-ar', sessionInit).then(onSessionStarted)
const xr: THREE.XR = (navigator as any).xr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unconventional, but i think i'd prefer a @ts-expect-error here instead, small description afterwards explaining that we need to add webxr types which might be an open issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me, will update

src/webxr/VRButton.ts Show resolved Hide resolved
@vercel
Copy link

vercel bot commented Mar 9, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pmndrs/three-stdlib/7Y5z8x3YrQqzzG4zL48E1EDpSNds
✅ Preview: Failed

[Deployment for 3b1517f failed]

@joshuaellis joshuaellis marked this pull request as draft March 15, 2021 19:28
@joshuaellis joshuaellis added the typescript All things TS label Mar 15, 2021
@CodyJasonBennett
Copy link
Member

Continuing in #241. three.js has broken a lot of stuff around WebXR and its renderers since.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typescript All things TS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants