Phasing out Extensible

This commit is contained in:
thosakwe 2017-08-03 12:14:21 -04:00
parent 092cda9fec
commit c613ca4108
5 changed files with 11 additions and 8 deletions

View file

@ -1,6 +1,6 @@
# angel_route # angel_route
![version 1.0.4](https://img.shields.io/badge/version-1.0.4-brightgreen.svg) [![Pub](https://img.shields.io/pub/v/angel_route.svg)](https://pub.dartlang.org/packages/angel_route)
![build status](https://travis-ci.org/angel-dart/route.svg) ![build status](https://travis-ci.org/angel-dart/route.svg)
A powerful, isomorphic routing library for Dart. A powerful, isomorphic routing library for Dart.

View file

@ -39,11 +39,10 @@ abstract class BrowserRouter extends Router {
void listen(); void listen();
/// Identical to [all]. /// Identical to [all].
Route on(Pattern path, handler, {List middleware}) => Route on(Pattern path, handler, {List middleware});
all(path, handler, middleware: middleware);
} }
class _BrowserRouterImpl extends Router implements BrowserRouter { abstract class _BrowserRouterImpl extends Router implements BrowserRouter {
Route _current; Route _current;
StreamController<RoutingResult> _onResolve = StreamController<RoutingResult> _onResolve =
new StreamController<RoutingResult>(); new StreamController<RoutingResult>();
@ -64,6 +63,9 @@ class _BrowserRouterImpl extends Router implements BrowserRouter {
@override @override
void go(Iterable linkParams) => _goTo(navigate(linkParams)); void go(Iterable linkParams) => _goTo(navigate(linkParams));
Route on(Pattern path, handler, {List middleware}) =>
all(path, handler, middleware: middleware);
void prepareAnchors() { void prepareAnchors() {
final anchors = window.document.querySelectorAll('a:not([dynamic])'); final anchors = window.document.querySelectorAll('a:not([dynamic])');
@ -153,7 +155,7 @@ class _PushStateRouter extends _BrowserRouterImpl {
} else { } else {
final route = resolved.route; final route = resolved.route;
window.history.pushState( window.history.pushState(
{'path': route.path, 'params': {}, 'properties': properties}, {'path': route.path, 'params': {}},
route.name ?? route.path, route.name ?? route.path,
relativeUri); relativeUri);
_onResolve.add(resolved); _onResolve.add(resolved);
@ -167,7 +169,7 @@ class _PushStateRouter extends _BrowserRouterImpl {
final resolved = resolveAbsolute(path); final resolved = resolveAbsolute(path);
if (resolved != null && resolved.route != _current) { if (resolved != null && resolved.route != _current) {
properties.addAll(state['properties'] ?? {}); //properties.addAll(state['properties'] ?? {});
_onResolve.add(resolved); _onResolve.add(resolved);
_onRoute.add(_current = resolved.route _onRoute.add(_current = resolved.route
..state.properties.addAll(state['params'] ?? {})); ..state.properties.addAll(state['params'] ?? {}));

View file

@ -5,6 +5,7 @@ final RegExp _sym = new RegExp(r'Symbol\("([^"]+)"\)');
/// ///
/// No longer requires reflection. :) /// No longer requires reflection. :)
@proxy @proxy
@deprecated
class Extensible { class Extensible {
/// A set of custom properties that can be assigned to the server. /// A set of custom properties that can be assigned to the server.
/// ///

View file

@ -15,7 +15,7 @@ final RegExp _slashDollar = new RegExp(r'/+\$');
final RegExp _straySlashes = new RegExp(r'(^/+)|(/+$)'); final RegExp _straySlashes = new RegExp(r'(^/+)|(/+$)');
/// An abstraction over complex [Route] trees. Use this instead of the raw API. :) /// An abstraction over complex [Route] trees. Use this instead of the raw API. :)
class Router extends Extensible { class Router {
final List<_ChainedRouter> _chained = []; final List<_ChainedRouter> _chained = [];
final List _middleware = []; final List _middleware = [];
final Map<Pattern, Router> _mounted = {}; final Map<Pattern, Router> _mounted = {};

View file

@ -1,6 +1,6 @@
name: angel_route name: angel_route
description: A powerful, isomorphic routing library for Dart. description: A powerful, isomorphic routing library for Dart.
version: 1.0.4 version: 1.0.5
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/angel_route homepage: https://github.com/angel-dart/angel_route
dev_dependencies: dev_dependencies: