Skip to content

Feature typescript webpack 02 attempt#184

Merged
kalwalt merged 19 commits intodevfrom
feature-typescript-webpack-02
Jun 6, 2021
Merged

Feature typescript webpack 02 attempt#184
kalwalt merged 19 commits intodevfrom
feature-typescript-webpack-02

Conversation

@kalwalt
Copy link
Copy Markdown
Member

@kalwalt kalwalt commented May 27, 2021

This is the continue of PR #167, I'm reducing the changes, to avoid breaking changes. I will try to simply port the existent code to typescript.

  • solve objVisibilty issue.
  • check if all the methods and functionality are restored
  • new methods dispose Worker (stop)
  • documentation
  • add license header to every files code.

@kalwalt kalwalt added 🚀 enhancement New feature or request webpack about issue on webpack Typescript labels May 27, 2021
@kalwalt kalwalt self-assigned this May 27, 2021
- uuid string is passed to the NFTWorker for the GL_RH matrix
@kalwalt
Copy link
Copy Markdown
Member Author

kalwalt commented May 28, 2021

The red cube when the marker is lost, is still visible. This should not happens because in the arNFT_example.html objVisibility = false. Need to be fixed.

@kalwalt
Copy link
Copy Markdown
Member Author

kalwalt commented May 30, 2021

In a React environment i get this error:

index.js:1 SyntaxError: Unexpected token < in JSON at position 0
console.<computed> @ index.js:1
(anonymous) @ ARUtils.ts:37
Promise.catch (async)
getConfig @ ARUtils.ts:35
initialize @ ARnft.ts:44
init @ ARnft.ts:34
(anonymous) @ App.js:10
./src/App.js @ App.js:72
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
(anonymous) @ index.css?bb0a:82
./src/index.js @ index.js:18
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ serviceWorker.js:142
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
ARnft-ES6-react:1 Uncaught (in promise) false

This not happens with commonJs (the code inside <script>), and i think probably related to kalwalt/ARnft-ES6-react#16. The issue seems to come from the getConfig function, i will implement the old one with axios, that not caused any issue.

@kalwalt
Copy link
Copy Markdown
Member Author

kalwalt commented May 30, 2021

related to the issue #184 (comment) i tried to change the path of the config file:

+ ARnft.init(640, 480, "DataNFT/pinball", '/../config.json', true)
- ARnft.init(640, 480, "DataNFT/pinball", 'config.json', true)

and in the production build works as usual, everything can be loaded. Probably need a different path because i add the extra path?

@kalwalt
Copy link
Copy Markdown
Member Author

kalwalt commented Jun 2, 2021

For the react issue: i got it work with the newest version see https://github.com/kalwalt/ARnft-ES6-react/tree/upgrading-arnft

Back to the objVisibility issue:
The problem is in this routine:

ARnft/src/NFTWorker.ts

Lines 142 to 147 in 8b3db27

if (!msg) {
if (world) {
world = null
const nftTrackingLostEvent = new CustomEvent('nftTrackingLost')
document.dispatchEvent(nftTrackingLostEvent)
}

when the msg is null ( i.e. when the NFT marker is lost) and so it is valid if (!msg) { } the world variable is undefined and so the event is skipped, and so the nftTrackingLost is not sent... Probably this routine was ok for Javascript but not converted to Typescript. I can try another solution or temporarly skip this.

@kalwalt
Copy link
Copy Markdown
Member Author

kalwalt commented Jun 2, 2021

In the next days i will add some doc comments for Typescript and i think it will almost ready for merging.

@kalwalt
Copy link
Copy Markdown
Member Author

kalwalt commented Jun 4, 2021

I think i added all the features but i will check in the next days, with a fresh mind.

@kalwalt kalwalt changed the base branch from master to dev June 5, 2021 21:13
@kalwalt kalwalt merged commit 2aa7615 into dev Jun 6, 2021
@kalwalt kalwalt mentioned this pull request Jun 6, 2021
@kalwalt kalwalt deleted the feature-typescript-webpack-02 branch October 9, 2021 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚀 enhancement New feature or request Typescript webpack about issue on webpack

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant