jonkh

Q: Organizing Subclasses & Plugs

Hi, I'm trying to organize my growing code by splitting various Subclasses into separate files. If the subclasses are imported as .js assets, it seems that they can't be loaded ( ReferenceError: Can't find variable: MySubClass ) . Is there a way to have these subclasses elsewhere than in Global.js / Outlet code ?

 

Also, having a GUI to manage these would definitely help in the design. If we need to pass through iAd-plugs, could you please point out some ressources / tutorials ?

 

Any comments / suggestions would ge greatly appreciated,

 

Thanks !

Posted on Aug 21, 2013 3:56 AM

Close

Q: Organizing Subclasses & Plugs

  • All replies
  • Helpful answers

  • by patixa,Solvedanswer

    patixa patixa Aug 26, 2013 3:32 PM in response to jonkh
    Level 3 (597 points)
    Aug 26, 2013 3:32 PM in response to jonkh

    If you add your .js files to the Asset Library, they should "just work". If the .js files are in a folder, and you import the folder into iAd Producer, it will keep the files organized by folder.

     

    In looking at the available example projects, several have a .js file as an asset:

    • Cupcake Aviary: CupcakeBuilder.js
    • Forms: Validator.js
    • Hudson Telegraph: MorseConverter.js
    • Space Tours to Mars: Validator.js

    In looking how they're used, they appear to be called from an event handler and NOT Global.js, so maybe that's your problem?

     

    Also, I see that iAd Producer supports a "requires" notation, e.g. in Space Tour's TryIt-emailButton.js:

    //= requires iAd.MailMessage

    So, perhaps you need to add that at the top of your subclass files.

     

    Finally, plugins haven't been documented in a long time, so I guess Apple doesn't want to support them anymore.

  • by jonkh,

    jonkh jonkh Aug 28, 2013 1:05 AM in response to patixa
    Level 1 (0 points)
    Aug 28, 2013 1:05 AM in response to patixa

    Thanks for that clear reply and pointing out to some examples !

     

    Seems I missed the //= requires in my imported js assets... Works perfectly.

    Didn't know that folder import feature too, vert nice.