mirror of
				https://github.com/flynx/guaranteeEvents.git
				synced 2025-10-31 12:00:10 +00:00 
			
		
		
		
	Compare commits
	
		
			9 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| ae560cd00a | |||
| 541f4bfe82 | |||
| 9be9caefc9 | |||
| 3572df122e | |||
| bf9674d063 | |||
| 7b16dc493f | |||
| 32a8826587 | |||
| 01ca45aec3 | |||
| b068e0b49a | 
							
								
								
									
										7
									
								
								.editorconfig
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										7
									
								
								.editorconfig
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,7 @@ | ||||
| root = true | ||||
| 
 | ||||
| [**] | ||||
| indent_style = tab | ||||
| tab_width = 4 | ||||
| charset = utf-8 | ||||
| end_of_line = lf | ||||
							
								
								
									
										2
									
								
								LICENSE
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										2
									
								
								LICENSE
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -1,4 +1,4 @@ | ||||
| Copyright (c) 2014, Alex A. Naanou | ||||
| Copyright (c) 2014-2023, Alex A. Naanou | ||||
| All rights reserved. | ||||
| 
 | ||||
| Redistribution and use in source and binary forms, with or without | ||||
|  | ||||
							
								
								
									
										17
									
								
								README.md
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										17
									
								
								README.md
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -11,7 +11,7 @@ will provide the following functionality: | ||||
| * Call new handlers of the specified event with each of the prior event | ||||
| data sets in order of event occurrence. | ||||
| 
 | ||||
| * Add a `.clearGuaranteedQueue(<evetn>)` method to the emitter to facilitate | ||||
| * Add a `.clearGuaranteedQueue(<event>)` method to the emitter to facilitate | ||||
| event cache cleaning. | ||||
| 
 | ||||
| This is useful for modules like [glob](https://github.com/isaacs/node-glob)  | ||||
| @ -58,7 +58,8 @@ emitter.emit('event', 'some data') | ||||
| 
 | ||||
| ``` | ||||
| 
 | ||||
| A real-life use-case: | ||||
| A real-life use-case using the excellent [glob](https://github.com/isaacs/node-glob)  | ||||
| utility: | ||||
| ```javascript | ||||
| var glob = require('glob') | ||||
| var guaranteeEvents = require('guarantee-events') | ||||
| @ -81,14 +82,14 @@ results.on('match', function(path){ console.log('found: '+path) }) | ||||
| Cache cleaning and use for long running emitters | ||||
| ------------------------------------------------ | ||||
| 
 | ||||
| This is not recommended for use in long running event emitters as each | ||||
| event emitted data will get stored and might get quite large, i.e. a | ||||
| potential source for a leak. | ||||
| One of the dangers in using this in long running event emitters is _cache  | ||||
| buildup_ -- the data for each event emitted will get stored and this | ||||
| might get quite large, this, if not managed, is a potential memory leak. | ||||
| 
 | ||||
| To deal with this issue a `.clearGuaranteedQueue(<event>)` method is  | ||||
| added to the emitter, this will clear the cache for a specific event and | ||||
| a shorthand form `.clearGuaranteedQueue('*')` that will clear the cache | ||||
| for all wrapped events. | ||||
| added to the emitter, this will clear the cache for a specific event.  | ||||
| This and has a shorthand form `.clearGuaranteedQueue('*')` that will  | ||||
| clear the cache for all wrapped events. | ||||
| 
 | ||||
| So for the above example: | ||||
| ```javascript | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "guarantee-events", | ||||
|   "version": "1.0.4", | ||||
|   "version": "1.0.6", | ||||
|   "description": "Guarantee that every event handler gets every event...", | ||||
|   "main": "index.js", | ||||
|   "scripts": { | ||||
| @ -18,7 +18,7 @@ | ||||
|     "event" | ||||
|   ], | ||||
|   "author": "Alex A. Naanou <alex.nanou@gmail.com> (https://github.com/flynx)", | ||||
|   "license": "New BSD", | ||||
|   "license": "BSD-3-Clause", | ||||
|   "bugs": { | ||||
|     "url": "https://github.com/flynx/guaranteeEvents/issues" | ||||
|   }, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user