2017-02-15 00:14:40 +00:00
|
|
|
/**
|
|
|
|
|
* @license
|
2020-05-19 19:08:49 +00:00
|
|
|
* Copyright Google LLC All Rights Reserved.
|
2017-02-15 00:14:40 +00:00
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
|
|
|
|
|
2019-03-12 00:20:40 +00:00
|
|
|
import {DOCUMENT} from '@angular/common';
|
2017-08-08 09:17:40 +00:00
|
|
|
import {Inject, Injectable} from '@angular/core';
|
2017-02-15 00:14:40 +00:00
|
|
|
|
2017-08-08 09:17:40 +00:00
|
|
|
import {serializeDocument} from './domino_adapter';
|
|
|
|
|
|
2017-02-15 00:14:40 +00:00
|
|
|
/**
|
|
|
|
|
* Representation of the current platform state.
|
|
|
|
|
*
|
2018-10-19 11:12:20 +00:00
|
|
|
* @publicApi
|
2017-02-15 00:14:40 +00:00
|
|
|
*/
|
|
|
|
|
@Injectable()
|
|
|
|
|
export class PlatformState {
|
|
|
|
|
constructor(@Inject(DOCUMENT) private _doc: any) {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Renders the current state of the platform to string.
|
|
|
|
|
*/
|
2020-04-13 23:40:21 +00:00
|
|
|
renderToString(): string {
|
|
|
|
|
return serializeDocument(this._doc);
|
|
|
|
|
}
|
2017-02-15 00:14:40 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the current DOM state.
|
|
|
|
|
*/
|
2020-04-13 23:40:21 +00:00
|
|
|
getDocument(): any {
|
|
|
|
|
return this._doc;
|
|
|
|
|
}
|
2017-02-17 20:55:55 +00:00
|
|
|
}
|