2016-08-04 4 views
0

나는이 opensource 코어를 사용하여 자신의 기능을 추가하려고합니다. 내가 그것을 호출하는 방법을 여기서비스에서 public 메서드를 만드는 방법

"use strict"; 
define([ 
    'mediastream/webrtc' 
    ], function(WebRTC) { 
    return function() { 
     this.testcall = function() { 
     console.log(1); 
    } 
    }; 
}); 

은 다음과 같습니다 : 여기

는 서비스입니다
"use strict"; 
    define(['underscore', 'text!partials/buddylist.html'], function(_, template) { 

    // buddyList 
    return ["buddyList", "api", "webrtc", "contacts", "sourceDistribution", function(buddyList, api, webrtc, contacts, sourceDistribution) { 


    //console.log("buddyList directive"); 

    var controller = ['$scope', '$element', '$attrs', function($scope, $element, $attrs) { 

... 

     $scope.doViewBroadcast = function(id) { 
      sourceDistribution.testcall(); 
     }; 

그래서 어떻게 하나의 호출 testcall() 기능?

+0

없음 아이디어? ....... – IvRRimUm

답변

0

이 작동 :

"use strict"; 
define([ 
    'mediastream/webrtc' 
], function(WebRTC) { 

    var Testi = function(api) { 
    var broadCastTypes = ["call", "video"]; 
    } 

    Testi.prototype.doCall = function(api) { 
    console.log(1); 
    } 

    return ["api", function(api) { 
    return new Testi(api); 
    }]; 
}); 

호출 : sourceDistribution.doCall(id);

관련 문제