Start a new topic

Use of module pattern?

Use of module pattern?

Hello. I'm trying to develop the front end for an application using the workflow & JS build tools I'm accustomed to on the web. ReactJS, Webpack, etc.

I'm wondering when/how/if it will be possible to import the `AR` module like other libraries. Does this even make sense? I have no idea how the AR module is launched into the global namespace, I can only assume by the `architect://architect.js` script tag ?

For example, I want to do something like this here:

However since I have no way of getting AR into scope (I assume) all the best practices of JavaScript development kind of go out the window.

Is there any hope at all of working this out? Since JS does all the heavy lifting here for these applications I'd really like to be able to use a modern JS dev environment.

Thanks for all your work! I love the SDK once I finally translated from ObjC -> Swift correctly.




You are right in assuming that the global AR object is created when you import it through the architect://architect.js line.

However, keep in mind that the SDK does not work in a regular web browser. You will need to run it in your own app (hence the need for an Android or iOS application that includes the SDK). Our JavaScript library is not a regular webpage-importable JS library like jQuery, AngularJS and the like, it requires an app it can reside in. It mimics the behavior of a regular JS library, to give web developers the same environment they are used to work in, however, it still needs an app to run.

We will let you know once we have a solution available where you can use our SDK in a regular webpage.

Hope this helps!



I understand.

Would you consider perhaps making available a shim that acts as a stand-in during development? I may just do this myself anyway but I think many people would appreciate anything that makes development a little more streamlined. I can (and probably will) make my own shim, but it would be ideal if you guys provided one to ensure it keeps up-to-date with each release.


Hi Matt,

Right now, this is not on our roadmap, so I can't give you any ETA for this. However, your approach is interesting, and we'll discuss this internally to get this feature on our roadmap.

Just in case you are willing to share your mock once created with us, we'll be happy to discuss further if we can direct people with similar intentions to your mock implementation, so they can make use of it in the meantime.



Alright Martin, thank you very much. I think it would be a valuable addition to help folks get going.

I'll be glad to share back my shim implementation which is guaranteed to be incomplete :)


For anyone who comes across this thread, all I did was create this module:

Then in my other modules, I just do `var AR = require('../ARShim');` and the code runs both in the browser and on the device.

I know you guys have an interest in protecting your source code here but without `console.log` or `debugger`, troubleshooting and otherwise understanding what is going on on the device is WAY too hard.
Login or Signup to post a comment