Skip to content

Commit

Permalink
Move document-state to services (#6336)
Browse files Browse the repository at this point in the history
* Move document-state to services

* fixes

* fixes
  • Loading branch information
Dima Voytenko committed Nov 29, 2016
1 parent b652d1c commit 2ae68aa
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ads/google/a4a/test/test-google-ads-a4a-config.js
Expand Up @@ -24,7 +24,7 @@ import {resetExperimentToggles_} from '../../../../src/experiments';
import {installPlatformService} from '../../../../src/service/platform-impl';
import {installViewerServiceForDoc} from '../../../../src/service/viewer-impl';
import {resetServiceForTesting} from '../../../../src/service';
import {documentStateFor} from '../../../../src/document-state';
import {documentStateFor} from '../../../../src/service/document-state';
import * as sinon from 'sinon';

const EXP_ID = 'EXP_ID';
Expand Down
10 changes: 10 additions & 0 deletions build-system/tasks/presubmit-checks.js
Expand Up @@ -108,6 +108,16 @@ var forbiddenTerms = {
'\\.prefetch\\(': {
message: 'Do not use preconnect.prefetch, use preconnect.preload instead.'
},
'documentStateFor': {
message: privateServiceFactory,
whitelist: [
'src/custom-element.js',
'src/style-installer.js',
'src/service/document-state.js',
'src/service/viewer-impl.js',
'src/service/vsync-impl.js',
],
},
'iframePing': {
message: 'This is only available in vendor config for ' +
'temporary workarounds.',
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-analytics/0.1/test/test-instrumentation.js
Expand Up @@ -28,7 +28,7 @@ import {installPlatformService} from '../../../../src/service/platform-impl';
import {
installResourcesServiceForDoc,
} from '../../../../src/service/resources-impl';
import {documentStateFor} from '../../../../src/document-state';
import {documentStateFor} from '../../../../src/service/document-state';


adopt(window);
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-analytics/0.1/test/test-visibility-impl.js
Expand Up @@ -36,7 +36,7 @@ import {installPlatformService} from '../../../../src/service/platform-impl';
import {
installResourcesServiceForDoc,
} from '../../../../src/service/resources-impl';
import {documentStateFor} from '../../../../src/document-state';
import {documentStateFor} from '../../../../src/service/document-state';

adopt(window);

Expand Down
2 changes: 1 addition & 1 deletion src/custom-element.js
Expand Up @@ -22,7 +22,7 @@ import {ElementStub, stubbedElements} from './element-stub';
import {ampdocServiceFor} from './ampdoc';
import {createLoaderElement} from '../src/loader';
import {dev, rethrowAsync, user} from './log';
import {documentStateFor} from './document-state';
import {documentStateFor} from './service/document-state';
import {
getIntersectionChangeEntry,
} from '../src/intersection-observer-polyfill';
Expand Down
8 changes: 4 additions & 4 deletions src/document-state.js → src/service/document-state.js
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

import {Observable} from './observable';
import {fromClass} from './service';
import {getVendorJsPropertyName} from './style';
import {waitForChild} from './dom';
import {Observable} from '../observable';
import {fromClass} from '../service';
import {getVendorJsPropertyName} from '../style';
import {waitForChild} from '../dom';


/**
Expand Down
4 changes: 2 additions & 2 deletions src/service/viewer-impl.js
Expand Up @@ -16,7 +16,7 @@

import {Observable} from '../observable';
import {findIndex} from '../utils/array';
import {documentStateFor} from '../document-state';
import {documentStateFor} from './document-state';
import {getServiceForDoc} from '../service';
import {dev} from '../log';
import {
Expand Down Expand Up @@ -94,7 +94,7 @@ export class Viewer {
/** @private @const {boolean} */
this.isIframed_ = (this.win.parent && this.win.parent != this.win);

/** @const {!../document-state.DocumentState} */
/** @const {!./document-state.DocumentState} */
this.docState_ = documentStateFor(this.win);

/** @private {boolean} */
Expand Down
4 changes: 2 additions & 2 deletions src/service/vsync-impl.js
Expand Up @@ -18,7 +18,7 @@ import {Pass} from '../pass';
import {ampdocServiceFor} from '../ampdoc';
import {cancellation} from '../error';
import {dev, rethrowAsync} from '../log';
import {documentStateFor} from '../document-state';
import {documentStateFor} from './document-state';
import {getService} from '../service';
import {installTimerService} from './timer-impl';
import {viewerForDoc, viewerPromiseForDoc} from '../viewer';
Expand Down Expand Up @@ -62,7 +62,7 @@ export class Vsync {
/** @private @const {!./ampdoc-impl.AmpDocService} */
this.ampdocService_ = ampdocServiceFor(this.win);

/** @private @const {!../document-state.DocumentState} */
/** @private @const {!./document-state.DocumentState} */
this.docState_ = documentStateFor(this.win);

/** @private @const {function(function())} */
Expand Down
2 changes: 1 addition & 1 deletion src/style-installer.js
Expand Up @@ -15,7 +15,7 @@
*/

import {dev, rethrowAsync} from './log';
import {documentStateFor} from './document-state';
import {documentStateFor} from './service/document-state';
import {performanceFor} from './performance';
import {setStyles} from './style';
import {waitForServices} from './render-delaying-services';
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test-document-state.js
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import {DocumentState} from '../../src/document-state';
import {DocumentState} from '../../src/service/document-state';
import * as dom from '../../src/dom';
import * as sinon from 'sinon';

Expand Down

0 comments on commit 2ae68aa

Please sign in to comment.