chore: disable dart for HTTP package

BREAKING CHANGE

Stop supporting http module in Dart. This is because Dart has a
well developed http package which should be used by Dart
customers instead.
This commit is contained in:
Misko Hevery
2015-08-12 13:03:28 -07:00
parent 38945955ab
commit 284dc67076
15 changed files with 2137 additions and 1968 deletions

View File

@ -4,7 +4,6 @@ environment:
dependencies:
angular2: '^<%= packageJson.version %>'
angular2_material: '^<%= packageJson.version %>'
http: '^<%= packageJson.version %>'
browser: '^0.10.0'
dev_dependencies:
guinness: '^0.1.17'
@ -15,8 +14,6 @@ dependency_overrides:
path: ../angular2
angular2_material:
path: ../angular2_material
http:
path: ../http
transformers:
- angular2:
$exclude:
@ -29,7 +26,6 @@ transformers:
entry_points:
- web/src/gestures/index.dart
- web/src/hello_world/index.dart
- web/src/http/index.dart
- web/src/key_events/index.dart
- web/src/sourcemap/index.dart
- web/src/todo/index.dart
@ -53,7 +49,6 @@ transformers:
reflection_entry_points:
- web/src/gestures/index.dart
- web/src/hello_world/index.dart
- web/src/http/index.dart
- web/src/key_events/index.dart
- web/src/sourcemap/index.dart
- web/src/todo/index.dart

View File

@ -1,25 +0,0 @@
library examples.src.jsonp.jsonp_comp;
import "package:angular2/angular2.dart" show Component, View, NgFor;
import "package:http/http.dart" show Jsonp;
import "package:angular2/src/facade/async.dart" show ObservableWrapper;
@Component(selector: "jsonp-app")
@View(
directives: const [NgFor],
template: '''
<h1>people</h1>
<ul class="people">
<li *ng-for="#person of people">
hello, {{person[\'name\']}}
</li>
</ul>
''')
class JsonpCmp {
Object people;
JsonpCmp(Jsonp jsonp) {
ObservableWrapper.subscribe(
jsonp.get("./people.json?callback=JSONP_CALLBACK"),
(res) => this.people = res.json().toList());
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ import {
Location,
RouteParams
} from 'angular2/router';
import {Http, Response} from 'http/http';
import * as db from './data';
import {ObservableWrapper, PromiseWrapper} from 'angular2/src/facade/async';
import {ListWrapper} from 'angular2/src/facade/collection';
import {isPresent} from 'angular2/src/facade/lang';
@ -59,12 +59,9 @@ class InboxRecord {
@Injectable()
class DbService {
constructor(public http: Http) {}
getData() {
var p = PromiseWrapper.completer();
ObservableWrapper.subscribe<Response>(this.http.get('./db.json'),
(resp) => { p.resolve(resp.json()); });
p.resolve(db.data);
return p.promise;
}

View File

@ -2,14 +2,11 @@ import {InboxApp} from './inbox-app';
import {bind} from 'angular2/angular2';
import {bootstrap} from 'angular2/bootstrap';
import {routerInjectables, HashLocationStrategy, LocationStrategy} from 'angular2/router';
import {HTTP_BINDINGS} from 'http/http';
import {reflector} from 'angular2/src/reflection/reflection';
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
export function main() {
reflector.reflectionCapabilities = new ReflectionCapabilities();
bootstrap(
InboxApp,
[routerInjectables, HTTP_BINDINGS, bind(LocationStrategy).toClass(HashLocationStrategy)]);
bootstrap(InboxApp, [routerInjectables, bind(LocationStrategy).toClass(HashLocationStrategy)]);
}

View File

@ -1,3 +0,0 @@
library http.sfx;
// empty as we don't have a version for Dart

View File

@ -1,3 +0,0 @@
library http.index;
//no dart implementation

View File

@ -1,19 +0,0 @@
name: http
version: <%= packageJson.version %>
authors:
<%= Object.keys(packageJson.contributors).map(function(name) {
return '- '+name+' <'+packageJson.contributors[name]+'>';
}).join('\n') %>
description: Angular 2 Http Module
homepage: <%= packageJson.homepage %>
environment:
sdk: '>=1.10.0 <2.0.0'
dependencies:
angular2: '^<%= packageJson.version %>'
dev_dependencies:
guinness: '^0.1.17'
dependency_overrides:
angular2:
path: ../angular2
transformers:
- angular2

View File

@ -1,62 +0,0 @@
library angular2_http.src.backends.browser_jsonp;
import 'package:angular2/di.dart';
import 'dart:html' show document;
import 'dart:js' show context, JsObject, JsArray;
int _nextRequestId = 0;
const JSONP_HOME = '__ng_jsonp__';
var _jsonpConnections = null;
JsObject _getJsonpConnections() {
if (_jsonpConnections == null) {
_jsonpConnections = context[JSONP_HOME] = new JsObject(context['Object']);
}
return _jsonpConnections;
}
// Make sure not to evaluate this in a non-browser environment!
@Injectable()
class BrowserJsonp {
// Construct a <script> element with the specified URL
dynamic build(String url) {
var node = document.createElement('script');
node.src = url;
return node;
}
nextRequestID() {
return "__req${_nextRequestId++}";
}
requestCallback(String id) {
return """${JSONP_HOME}.${id}.finished""";
}
exposeConnection(String id, dynamic connection) {
var connections = _getJsonpConnections();
var wrapper = new JsObject(context['Object']);
wrapper['_id'] = id;
wrapper['__dart__'] = connection;
wrapper['finished'] = ([dynamic data]) => connection.finished(data);
connections[id] = wrapper;
}
removeConnection(String id) {
var connections = _getJsonpConnections();
connections[id] = null;
}
// Attach the <script> element to the DOM
send(dynamic node) {
document.body.append(node);
}
// Remove <script> element from the DOM
cleanup(dynamic node) {
node.remove();
}
}

View File

@ -1,11 +0,0 @@
library angular2_http.src.backends.browser_xhr;
import 'dart:html' show HttpRequest;
import 'package:angular2/di.dart';
@Injectable()
class BrowserXhr {
HttpRequest build() {
return new HttpRequest();
}
}

View File

@ -1,8 +0,0 @@
library angular2_http.src.http_utils;
import 'dart:js' show JsObject;
import 'dart:collection' show LinkedHashMap, LinkedHashSet;
bool isJsObject(o) {
return o is JsObject || o is LinkedHashMap || o is LinkedHashSet;
}