2017-02-14 19:14:40 -05:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2017-08-08 05:17:40 -04:00
|
|
|
import {Inject, Injectable} from '@angular/core';
|
2017-02-17 15:55:55 -05:00
|
|
|
import {DOCUMENT, ɵgetDOM as getDOM} from '@angular/platform-browser';
|
2017-02-14 19:14:40 -05:00
|
|
|
|
2017-08-08 05:17:40 -04:00
|
|
|
import {serializeDocument} from './domino_adapter';
|
|
|
|
|
2017-02-14 19:14:40 -05:00
|
|
|
/**
|
|
|
|
* Representation of the current platform state.
|
|
|
|
*
|
|
|
|
* @experimental
|
|
|
|
*/
|
|
|
|
@Injectable()
|
|
|
|
export class PlatformState {
|
|
|
|
constructor(@Inject(DOCUMENT) private _doc: any) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders the current state of the platform to string.
|
|
|
|
*/
|
2017-08-08 05:17:40 -04:00
|
|
|
renderToString(): string { return serializeDocument(this._doc); }
|
2017-02-14 19:14:40 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current DOM state.
|
|
|
|
*/
|
|
|
|
getDocument(): any { return this._doc; }
|
2017-02-17 15:55:55 -05:00
|
|
|
}
|