Skip to content

Commit

Permalink
chore(all): prepare release 1.0.0-beta.1.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed May 31, 2016
1 parent b897c80 commit 39f05b6
Show file tree
Hide file tree
Showing 14 changed files with 1,096 additions and 615 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-router",
"version": "1.0.0-beta.1.2.3",
"version": "1.0.0-beta.1.2.4",
"description": "A powerful client-side router.",
"keywords": [
"aurelia",
Expand Down
17 changes: 17 additions & 0 deletions dist/amd/aurelia-router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,23 @@ declare module 'aurelia-router' {
[x: string]: any;
}

/**
* A basic interface for an Observable type
*/
export interface IObservable {
subscribe(): ISubscription;
}

/**
* A basic interface for a Subscription to an Observable
*/
/**
* A basic interface for a Subscription to an Observable
*/
export interface ISubscription {
unsubscribe(): void;
}

/**
* The status of a Pipeline.
*/
Expand Down
72 changes: 65 additions & 7 deletions dist/amd/aurelia-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ define(['exports', 'aurelia-logging', 'aurelia-route-recognizer', 'aurelia-depen

for (var i = 0, length = nav.length; i < length; i++) {
var _current2 = nav[i];
if (!_current2.href) {
if (!_current2.config.href) {
_current2.href = _createRootedPath(_current2.relativeHref, this.baseUrl, this.history._hasPushState);
}
}
Expand Down Expand Up @@ -1310,11 +1310,69 @@ define(['exports', 'aurelia-logging', 'aurelia-route-recognizer', 'aurelia-depen
return output;
}

var SafeSubscription = function () {
function SafeSubscription(subscriptionFunc) {
_classCallCheck(this, SafeSubscription);

this._subscribed = true;
this._subscription = subscriptionFunc(this);

if (!this._subscribed) this.unsubscribe();
}

SafeSubscription.prototype.unsubscribe = function unsubscribe() {
if (this._subscribed && this._subscription) this._subscription.unsubscribe();

this._subscribed = false;
};

_createClass(SafeSubscription, [{
key: 'subscribed',
get: function get() {
return this._subscribed;
}
}]);

return SafeSubscription;
}();

function processPotential(obj, resolve, reject) {
if (obj && typeof obj.then === 'function') {
return Promise.resolve(obj).then(resolve).catch(reject);
}

if (obj && typeof obj.subscribe === 'function') {
var _ret4 = function () {
var obs = obj;
return {
v: new SafeSubscription(function (sub) {
return obs.subscribe({
next: function next() {
if (sub.subscribed) {
sub.unsubscribe();
resolve(obj);
}
},
error: function error(_error) {
if (sub.subscribed) {
sub.unsubscribe();
reject(_error);
}
},
complete: function complete() {
if (sub.subscribed) {
sub.unsubscribe();
resolve(obj);
}
}
});
})
};
}();

if ((typeof _ret4 === 'undefined' ? 'undefined' : _typeof(_ret4)) === "object") return _ret4.v;
}

try {
return resolve(obj);
} catch (error) {
Expand Down Expand Up @@ -1424,7 +1482,7 @@ define(['exports', 'aurelia-logging', 'aurelia-route-recognizer', 'aurelia-depen
component.config = config;

if ('configureRouter' in viewModel) {
var _ret4 = function () {
var _ret5 = function () {
var childRouter = childContainer.getChildRouter();
component.childRouter = childRouter;

Expand All @@ -1437,7 +1495,7 @@ define(['exports', 'aurelia-logging', 'aurelia-route-recognizer', 'aurelia-depen
};
}();

if ((typeof _ret4 === 'undefined' ? 'undefined' : _typeof(_ret4)) === "object") return _ret4.v;
if ((typeof _ret5 === 'undefined' ? 'undefined' : _typeof(_ret5)) === "object") return _ret5.v;
}

return component;
Expand Down Expand Up @@ -1581,11 +1639,11 @@ define(['exports', 'aurelia-logging', 'aurelia-route-recognizer', 'aurelia-depen
_Router.prototype.registerViewPort.call(this, viewPort, name);

if (!this.isActive) {
var _ret5 = function () {
var _ret6 = function () {
var viewModel = _this10._findViewModel(viewPort);
if ('configureRouter' in viewModel) {
if (!_this10.isConfigured) {
var _ret6 = function () {
var _ret7 = function () {
var resolveConfiguredPromise = _this10._resolveConfiguredPromise;
_this10._resolveConfiguredPromise = function () {};
return {
Expand All @@ -1600,14 +1658,14 @@ define(['exports', 'aurelia-logging', 'aurelia-route-recognizer', 'aurelia-depen
};
}();

if ((typeof _ret6 === 'undefined' ? 'undefined' : _typeof(_ret6)) === "object") return _ret6.v;
if ((typeof _ret7 === 'undefined' ? 'undefined' : _typeof(_ret7)) === "object") return _ret7.v;
}
} else {
_this10.activate();
}
}();

if ((typeof _ret5 === 'undefined' ? 'undefined' : _typeof(_ret5)) === "object") return _ret5.v;
if ((typeof _ret6 === 'undefined' ? 'undefined' : _typeof(_ret6)) === "object") return _ret6.v;
} else {
this._dequeueInstruction();
}
Expand Down
17 changes: 17 additions & 0 deletions dist/aurelia-router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,23 @@ declare module 'aurelia-router' {
[x: string]: any;
}

/**
* A basic interface for an Observable type
*/
export interface IObservable {
subscribe(): ISubscription;
}

/**
* A basic interface for a Subscription to an Observable
*/
/**
* A basic interface for a Subscription to an Observable
*/
export interface ISubscription {
unsubscribe(): void;
}

/**
* The status of a Pipeline.
*/
Expand Down
65 changes: 64 additions & 1 deletion dist/aurelia-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ export class Router {

for (let i = 0, length = nav.length; i < length; i++) {
let current = nav[i];
if (!current.href) {
if (!current.config.href) {
current.href = _createRootedPath(current.relativeHref, this.baseUrl, this.history._hasPushState);
}
}
Expand Down Expand Up @@ -1597,11 +1597,74 @@ function shouldContinue(output, router: Router) {
return output;
}

/**
* A basic interface for an Observable type
*/
interface IObservable {
subscribe(): ISubscription;
}

/**
* A basic interface for a Subscription to an Observable
*/
interface ISubscription {
unsubscribe(): void;
}

type SafeSubscriptionFunc = (sub: SafeSubscription) => ISubscription;

/**
* wraps a subscription, allowing unsubscribe calls even if
* the first value comes synchronously
*/
class SafeSubscription {
constructor(subscriptionFunc: SafeSubscriptionFunc) {
this._subscribed = true;
this._subscription = subscriptionFunc(this);

if (!this._subscribed) this.unsubscribe();
}

get subscribed(): boolean {
return this._subscribed;
}

unsubscribe(): void {
if (this._subscribed && this._subscription) this._subscription.unsubscribe();

this._subscribed = false;
}
}

function processPotential(obj, resolve, reject) {
if (obj && typeof obj.then === 'function') {
return Promise.resolve(obj).then(resolve).catch(reject);
}

if (obj && typeof obj.subscribe === 'function') {
let obs: IObservable = obj;
return new SafeSubscription(sub => obs.subscribe({
next() {
if (sub.subscribed) {
sub.unsubscribe();
resolve(obj);
}
},
error(error) {
if (sub.subscribed) {
sub.unsubscribe();
reject(error);
}
},
complete() {
if (sub.subscribed) {
sub.unsubscribe();
resolve(obj);
}
}
}));
}

try {
return resolve(obj);
} catch (error) {
Expand Down
17 changes: 17 additions & 0 deletions dist/commonjs/aurelia-router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,23 @@ declare module 'aurelia-router' {
[x: string]: any;
}

/**
* A basic interface for an Observable type
*/
export interface IObservable {
subscribe(): ISubscription;
}

/**
* A basic interface for a Subscription to an Observable
*/
/**
* A basic interface for a Subscription to an Observable
*/
export interface ISubscription {
unsubscribe(): void;
}

/**
* The status of a Pipeline.
*/
Expand Down
Loading

0 comments on commit 39f05b6

Please sign in to comment.