feat(web-workers) Add WebWorker Renderer
Allows angular apps to be rendered from the webworker! Closes #3052, #3053, and #3097
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import {AppRootUrl} from "angular2/src/services/app_root_url";
|
||||
import {DOM} from "angular2/src/dom/dom_adapter";
|
||||
import {Injectable} from "angular2/di";
|
||||
|
||||
/**
|
||||
* Extension of {@link AppRootUrl} that uses a DOM anchor tag to set the root url to
|
||||
* the current page's url.
|
||||
*/
|
||||
@Injectable()
|
||||
export class AnchorBasedAppRootUrl extends AppRootUrl {
|
||||
constructor() {
|
||||
super("");
|
||||
// compute the root url to pass to AppRootUrl
|
||||
var rootUrl: string;
|
||||
var a = DOM.createElement('a');
|
||||
DOM.resolveAndSetHref(a, './', null);
|
||||
rootUrl = DOM.getHref(a);
|
||||
|
||||
this.value = rootUrl;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import {Injectable} from 'angular2/di';
|
||||
import {isBlank} from 'angular2/src/facade/lang';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
/**
|
||||
* Specifies app root url for the application.
|
||||
@@ -15,16 +14,12 @@ import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
export class AppRootUrl {
|
||||
private _value: string;
|
||||
|
||||
constructor(value: string) { this._value = value; }
|
||||
|
||||
/**
|
||||
* Returns the base URL of the currently running application.
|
||||
*/
|
||||
get value() {
|
||||
if (isBlank(this._value)) {
|
||||
var a = DOM.createElement('a');
|
||||
DOM.resolveAndSetHref(a, './', null);
|
||||
this._value = DOM.getHref(a);
|
||||
}
|
||||
get value() { return this._value; }
|
||||
|
||||
return this._value;
|
||||
}
|
||||
set value(value: string) { this._value = value; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user