document loading

i want to host some of my javascript files on is it possible to load these files to the app during the create phase? for instance, if i have a kind in a js file for my calendar picker (CalendarPicker.js), when i pull this file down from how do i load it into the app? i'm assuming i can do the loading during the in the create function of the app, right? do i need to keep CalendarPicker.js in my package.js file? any help is appreciated!



  • edited May 2013
  • i do appreciate your quick response, however answer = empty script tag... there is a reason i posted this under newbie question (and not shortest answer wins)
  • rafa's rather succinct point is that using a script tag to include those is probably best. You can include them via enyo.depends() (as http:// URLs) but they won't (I think) be minified when you build your app. The browser will ensure that everything is loaded in the right order based on the order of the script tags.

    Alternatively, if you want to defer loading the kind completely until it's required, check out my extras.RemoteControl kind (source, example).
  • so, essentially i'm looking for a way to protect some of the source code for web apps. i know when it is ported via PhoneGap or the like to iOS, Android, etc. that there are some security features there, but how do i protect the code in all of those js files for web apps? i've never considered having a web app in the past, so this is my first exposure in trying to protect the source code. i just figured having my js file out in the secured parse cloud would keep people from pulling the js file off of my server that the app is being hosted from.

  • It does not matter where your files are hosted. You cannot really protect your code. Just use the minifier and forget about the rest. For most people it would not be possible to reconstruct the code.

    The web is open, just accept it.
  • haha - i accept. i'm good with that. thank you!
  • @shanerooni sorry, had to leavewhat I was doing, but wanted to reply you too...

    The point about protecting your code is: the sensitive code should be executed on the server, not on the client. So if you want to hide it, you must make a service and call it from your app to get the data.
  • edited May 2013
    @rafa_bernad - that's what i was looking for! thanks! something new to learn :) does enyo allow you to do that?
  • @shanerooni insomuch as you can use Enyo to make AJAX calls, then yes it will allow it It's the backend you want to focus on you implement your Web service in PHP or maybe node.js? Basically, you want to have a system that accepts an HTTP request (from your Enyo/client app), processes the request (on the server) and sends the response back to the client.
  • i don't implement anything (no server-side skills whatsoever) - i may just go with the minify and let it ride approach. there's nothing exceptionally proprietary that any semi-reasonable programmer that cared couldn't re-create. i'll just have to be first to market with a large marketing budget! LOL
  • I'd suggest investigated Parse's cloud code if you're already using their back end. That'd let you protect as much of the business logic and data access as you desire. Best of all, it uses their JavaScript SDK so there's really no new skills required.
  • thanks @theryanjduffy! i've seen the cloud code advertised, but haven't looked into it yet. looks like some good weekend reading. i do have some calculations that would be much nicer to have parse run for me, and just pull results. hopefully i'll have the problem someday of needing to buy their service (over 1M reqs) :)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!