closes #1807 - e2e tests now also cover the tax calculator. - Dart app updated to match TS (it had no sales tax calculator). - TS sample source cleanup (e.g. removed many unnecessary `docregions`). - Prose updated to include @kwalrath's revisions from a while ago, Ward's comments, and some of my edits as well. Contributes to #1598 and #1508.
		
			
				
	
	
		
			29 lines
		
	
	
		
			640 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			640 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'dart:async';
 | |
| 
 | |
| import 'package:angular2/core.dart';
 | |
| 
 | |
| import 'hero.dart';
 | |
| import 'logger_service.dart';
 | |
| 
 | |
| @Injectable()
 | |
| class BackendService {
 | |
|   static final _mockHeroes = [
 | |
|     new Hero('Windstorm', 'Weather mastery'),
 | |
|     new Hero('Mr. Nice', 'Killing them with kindness'),
 | |
|     new Hero('Magneta', 'Manipulates metalic objects')
 | |
|   ];
 | |
| 
 | |
|   final Logger _logger;
 | |
| 
 | |
|   BackendService(Logger this._logger);
 | |
| 
 | |
|   Future<List> getAll(type) {
 | |
|     // TODO get from the database
 | |
|     if (type == Hero) return new Future.value(_mockHeroes);
 | |
| 
 | |
|     var msg = 'Cannot get object of this type';
 | |
|     _logger.error(msg);
 | |
|     throw new Exception(msg);
 | |
|   }
 | |
| }
 |