How to build for cordova?

113 views
Skip to first unread message

Boris Reitman

unread,
Nov 12, 2017, 4:45:47 PM11/12/17
to Email.js Mailing List
How do I build emailjs into one bundle, that has everything?  I tried using browserify + babel, and it starts running, but then I get an error like this,

TypeError: expected at least one argument.

I can't figure out where the error happens.
Screen Shot 2017-11-12 at 1.43.42 PM.png

Boris Reitman

unread,
Nov 12, 2017, 6:22:34 PM11/12/17
to Email.js Mailing List
I made some more debugging, and found that this happens on this line:

this.remainder.subarray()

The subarray() function apparently expects at least one argument on iOS Safari.

So, how do I add the necessary shims for this to work? and all the other problems that might come up ?

Boris Reitman

unread,
Nov 12, 2017, 7:16:45 PM11/12/17
to Email.js Mailing List

So, I got the basic example to work on cordova ios after fixing Uint8Array.prototype.indexOf, Uint8Array.prototype.lastIndexOf, and Uint8Array.subarray when called with no arguments.

Also, I have problem with navigator.TCPSocket being properly registered. Somehow using browserify breaks this.

So my question is: can you add instructions on how to exactly build this for the browser ?

Boris Reitman

unread,
Nov 12, 2017, 7:25:04 PM11/12/17
to Email.js Mailing List
Update:


Also, I have problem with navigator.TCPSocket being properly registered. Somehow using browserify breaks this.


I got the TCPSocket to work after I delayed loading the library a bit. I think it takes time for cordova plugin to register itself.


          $(function(){
            setTimeout(function(){
              $.getScript("js/imap-client-browserify-bundle.js");
            },1000);
          });

The timeout may not be necessary. It's the first thing I tried and it worked.
Reply all
Reply to author
Forward
0 new messages