Best Optimal way to handle api/luna request between controller and service

What is best optimal way for calling any api or luna api from controller to serivce and make api request from serivce,
and again response to controller from service success.
in other words, any deferred and promise related concept as well?


  • edited June 2015
    Some good starting points would be:
    The developer guide, which discusses how to use models, collections, sources, and how to create your own source for an api.

    For use of the luna api, I think this page might help you along a bit:

    Finally, enyo doesn't implement it's own promise implementation but models and collections do have success and fail callbacks which you could wrap with a promise implementation of your choice. Something like:
    var refreshCollection = function(collection) {
      var promise = new Promise();
        success: function() {
        fail: function() {
      return promise;
    var collection = new enyo.Collection();
    refreshCollection(collection).then(function() {
      alert('data loaded!');
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!