Аttaching some javascript libraries seems to break scripts

61 views
Skip to first unread message

lalo

unread,
Jun 28, 2015, 5:06:56 AM6/28/15
to tas...@googlegroups.com
Hi. I have a simple script that basically calls one function from a third-party javascript library.
The minimal script file is just a plain call to the constructor:

var adate = new XDate();

The javascript library in question is: http://arshaw.com/xdate/downloads/0.8/xdate.js.

The script works fine if the text of the library is simply included in the script file on the device, and when tested in a browser on a PC with the Tasker-generated function library.

The action fails to work at all if the library file is attached to the javascript action as an external library. I've double- and triple-checked that the paths are correct -- the generated wrapper code in the log file has the script tag with a correct src attribute relative to the sdcard root.

The log file says the task has run and exited normally, but when I run it manually from the task list I see a green dot next to the action name, and it does nothing.

As far as I see, there is one similar question in this board (about jquery), but the end of that question was that a Tasker restart/reboot solved the issue. In my case, restarting Tasker or even rebooting doesn't help (not that I expected it would).

Any ideas where I should start looking for the problem?

TIA,

Odysseos

unread,
Jun 29, 2015, 2:15:59 AM6/29/15
to tas...@googlegroups.com
Hi. You have to add your URi in the Libraries field. Let say you have your xdate.js copied in Tasker/JS_Libs folder. To reference it in your javascript (javascriptlet) actions just type in the Libraries field: file:///sdcard/Tasker/JS_Libs/xdate.js

Juergen Gruen

unread,
Jul 1, 2015, 2:22:44 PM7/1/15
to tas...@googlegroups.com

For debugging, enable Tasker -> Preferences-Misc -> Popup Errors/Warnings. Tasker will show Errors/Warnings after a restart.

Also use try/catch in your scripts. Tasker will not stop on JavaScript runtime errors.

Juergen.
Reply all
Reply to author
Forward
0 new messages