Results 1 to 3 of 3
  1.    #1  
    Hey guys. I'm working on a project right now, and I'm running into some trouble. I've been using the Palm webOS developer's guides, textbook, and a few projects on github as references.

    I realize that it's hard to diagnose problems without the code, but frankly things are such a mess right now I'm not even going to try. I'll do my best to describe the problem.

    I've noticed that most apps make use of either an app/lib or app/helpers directory, to make things more modular and define some functions that will be used ubiquitously in the rest of the code. I've tried to do the same thing, but only get errors when I attempt to call my functions. I have the files listed in my sources.json, of course.

    Basically, I have a foo.jsjsjs $file$ $in$ $my$ $app$/$helpers$ $directory$, $but$ $when$ $I$ $attempt$ $to$ $make$ $calls$ $it$ $can$'$t$ $find$ $any$ $foo$.$function$(). $I$'$ve$ $been$ $looking$ $through$ $some$ $other$ $apps$, $and$ $it$ $seems$ $like$ $there$ $are$ $two$ $distinct$ $methods$ $to$ $make$ $this$ $work$, $but$ $I$ $don$'$t$ $understand$ $either$ $of$ $them$.

    One option seems to be to have a "config" object defined in the stage assistant, which creates some namespaces I guess... e.g. `var config = { foo: new foo() }` Then, that config object gets passed each time a scene is pushed. I've tried this and can't make it work, I still get the same "foo is not defined" error.

    The other option, as far as I can tell, is much more complex (I was looking at koto-player and spaz at the time).

    Could anyone shed some light on what I'm doing wrong, or maybe post a quick guide on how to make helpers work? I'm fairly new to javascript, and I'm stumped. Thanks in advance.

    - Andrew
  2.    #2  
    I've worked out how to do this with regular javascript on a webpage (with HTML elements), but not how it should be done in webOS.

    To simplify the above description... I basically just need one .jsjsjs $file$ $to$ $call$ $functions$ $from$ $another$ .$js$ $file$.
  3.    #3  
    I've found the solution, but unfortunately cannot link to the old topic since my current post count is <10.

    On the chance that someone comes in here looking for a solution, search the forum for "Calling a function in another javascript class."

    In short: the helper file needs to be listed before the scene assistants in sources.json.

Posting Permissions