mirror of
				https://github.com/esiur/esiur-dart.git
				synced 2025-10-31 07:41:34 +00:00 
			
		
		
		
	1.4.8
This commit is contained in:
		| @@ -1257,12 +1257,6 @@ class DistributedConnection extends NetworkConnection with IStore | ||||
|                   } | ||||
|  | ||||
|                   var r = res as IResource; | ||||
|                   r.instance.on("resourceEventOccurred", _instance_EventOccurred); | ||||
|                   r.instance.on("resourceModified", _instance_PropertyModified); | ||||
|                   r.instance.on("resourceDestroyed", _instance_ResourceDestroyed); | ||||
|                   r.instance.children.on("add", _children_OnAdd); | ||||
|                   r.instance.children.on("removed", _children_OnRemoved); | ||||
|                   r.instance.attributes.on("modified", _attributes_OnModified); | ||||
|  | ||||
|                   var link = DC.stringToBytes(r.instance.link); | ||||
|  | ||||
| @@ -1288,6 +1282,14 @@ class DistributedConnection extends NetworkConnection with IStore | ||||
|                               .addDC(Codec.composePropertyValueArray(r.instance.serialize(), this, true)) | ||||
|                               .done(); | ||||
|                   } | ||||
|  | ||||
|                   r.instance.on("resourceEventOccurred", _instance_EventOccurred); | ||||
|                   r.instance.on("resourceModified", _instance_PropertyModified); | ||||
|                   r.instance.on("resourceDestroyed", _instance_ResourceDestroyed); | ||||
|                   r.instance.children.on("add", _children_OnAdd); | ||||
|                   r.instance.children.on("removed", _children_OnRemoved); | ||||
|                   r.instance.attributes.on("modified", _attributes_OnModified); | ||||
|  | ||||
|               } | ||||
|               else | ||||
|               { | ||||
|   | ||||
| @@ -23,6 +23,7 @@ SOFTWARE. | ||||
| */ | ||||
|  | ||||
| import 'package:esyur/esyur.dart'; | ||||
| import 'package:esyur/src/Data/KeyValuePair.dart'; | ||||
|  | ||||
| import '../../Resource/IResource.dart'; | ||||
| import '../../Core/AsyncReply.dart'; | ||||
| @@ -43,10 +44,11 @@ class DistributedResource extends IResource | ||||
|  | ||||
|     String _link; | ||||
|     List _properties; | ||||
|  | ||||
|  | ||||
|     bool _destroyed = false; | ||||
|  | ||||
|  | ||||
|     List<KeyValuePair<int, dynamic>> _queued_updates =List<KeyValuePair<int, dynamic>>(); | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Connection responsible for the distributed resource. | ||||
|     /// </summary> | ||||
| @@ -162,12 +164,22 @@ class DistributedResource extends IResource | ||||
|  | ||||
|             _attached = true; | ||||
|  | ||||
|             if (_queued_updates.length > 0) | ||||
|             { | ||||
|               _queued_updates.forEach((kv)=>updatePropertyByIndex(kv.key, kv.value)); | ||||
|               _queued_updates.clear(); | ||||
|             } | ||||
|  | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     void emitEventByIndex(int index, List<dynamic> args) | ||||
|     { | ||||
|         // neglect events when the object is not yet attached | ||||
|         if (!_attached) | ||||
|           return; | ||||
|  | ||||
|         var et = instance.template.getEventTemplateByIndex(index); | ||||
|         //events[index]?.Invoke(this, args); | ||||
|         emitArgs(et.name, args); | ||||
| @@ -296,9 +308,16 @@ class DistributedResource extends IResource | ||||
|  | ||||
|     void updatePropertyByIndex(int index, dynamic value) | ||||
|     { | ||||
|         var pt = instance.template.getPropertyTemplateByIndex(index); | ||||
|         _properties[index] = value; | ||||
|         instance.emitModification(pt, value); | ||||
|         if (!_attached) | ||||
|         { | ||||
|            _queued_updates.add(KeyValuePair(index, value)); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|           var pt = instance.template.getPropertyTemplateByIndex(index); | ||||
|           _properties[index] = value; | ||||
|           instance.emitModification(pt, value); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /// <summary> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user