mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-30 00:23:21 +00:00 
			
		
		
		
	GUAC-605: Allow non-root scope for client and tunnel factories.
This commit is contained in:
		| @@ -260,8 +260,8 @@ angular.module('client').directive('guacClient', [function guacClient() { | |||||||
|                     return; |                     return; | ||||||
|  |  | ||||||
|                 // Get new client instance |                 // Get new client instance | ||||||
|                 var tunnel = guacTunnelFactory.getInstance(); |                 var tunnel = guacTunnelFactory.getInstance($scope); | ||||||
|                 client = guacClientFactory.getInstance(tunnel); |                 client = guacClientFactory.getInstance(tunnel, $scope); | ||||||
|  |  | ||||||
|                 // Init display |                 // Init display | ||||||
|                 display = client.getDisplay(); |                 display = client.getDisplay(); | ||||||
|   | |||||||
| @@ -33,9 +33,14 @@ angular.module('client').factory('guacClientFactory', ['$rootScope', | |||||||
|      * provided tunnel. |      * provided tunnel. | ||||||
|      * |      * | ||||||
|      * @param {Guacamole.Tunnel} tunnel The tunnel to connect through. |      * @param {Guacamole.Tunnel} tunnel The tunnel to connect through. | ||||||
|  |      * @param {Scope} [$scope] The current scope. If ommitted, the root scope | ||||||
|  |      *                         will be used. | ||||||
|      * @returns {Guacamole.Client} A new Guacamole client instance. |      * @returns {Guacamole.Client} A new Guacamole client instance. | ||||||
|      */ |      */ | ||||||
|     service.getInstance = function getClientInstance(tunnel) { |     service.getInstance = function getClientInstance(tunnel, $scope) { | ||||||
|  |  | ||||||
|  |         // Use root scope if no other scope provided | ||||||
|  |         $scope = $scope || $rootScope; | ||||||
|  |  | ||||||
|         // Instantiate client |         // Instantiate client | ||||||
|         var guacClient  = new Guacamole.Client(tunnel); |         var guacClient  = new Guacamole.Client(tunnel); | ||||||
|   | |||||||
| @@ -32,9 +32,14 @@ angular.module('client').factory('guacTunnelFactory', ['$rootScope', '$window', | |||||||
|      * Returns a new Guacamole tunnel instance, using an implementation that is |      * Returns a new Guacamole tunnel instance, using an implementation that is | ||||||
|      * supported by the web browser. |      * supported by the web browser. | ||||||
|      * |      * | ||||||
|  |      * @param {Scope} [$scope] The current scope. If ommitted, the root scope | ||||||
|  |      *                         will be used. | ||||||
|      * @returns {Guacamole.Tunnel} A new Guacamole tunnel instance. |      * @returns {Guacamole.Tunnel} A new Guacamole tunnel instance. | ||||||
|      */ |      */ | ||||||
|     service.getInstance = function getTunnelInstance() { |     service.getInstance = function getTunnelInstance($scope) { | ||||||
|  |  | ||||||
|  |         // Use root scope if no other scope provided | ||||||
|  |         $scope = $scope || $rootScope; | ||||||
|  |  | ||||||
|         var tunnel; |         var tunnel; | ||||||
|          |          | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user