feat(ivy): introduce `getPlayers()` to global utils (#27008)

PR Close #27008
This commit is contained in:
Matias Niemelä 2018-11-07 13:03:11 -08:00 committed by Andrew Kushnir
parent b9eeb1c383
commit e618032d53
4 changed files with 10 additions and 5 deletions

View File

@ -230,7 +230,7 @@ export {
export {
publishGlobalUtil as ɵpublishGlobalUtil,
publishDefaultGlobalUtils as ɵpublishDefaultGlobalUtils
} from './render3/publish_global_util';
} from './render3/global_utils';
export {
SWITCH_INJECTOR_FACTORY__POST_R3__ as ɵSWITCH_INJECTOR_FACTORY__POST_R3__,
} from './di/injector';

View File

@ -16,6 +16,7 @@ import {assertComponentType, assertDefined} from './assert';
import {getComponentViewByInstance} from './context_discovery';
import {getComponentDef} from './definition';
import {diPublicInInjector, getOrCreateNodeInjectorForNode} from './di';
import {publishDefaultGlobalUtils} from './global_utils';
import {queueInitHooks, queueLifecycleHooks} from './hooks';
import {CLEAN_PROMISE, createLViewData, createNodeAtIndex, createTView, getOrCreateTView, initNodeFlags, instantiateRootComponent, locateHostElement, prefillHostVars, queueComponentIndexForCheck, refreshDescendantViews} from './instructions';
import {ComponentDef, ComponentType} from './interfaces/definition';
@ -23,7 +24,6 @@ import {TElementNode, TNodeFlags, TNodeType} from './interfaces/node';
import {PlayerHandler} from './interfaces/player';
import {RElement, Renderer3, RendererFactory3, domRendererFactory3} from './interfaces/renderer';
import {CONTEXT, HEADER_OFFSET, HOST, HOST_NODE, INJECTOR, LViewData, LViewFlags, RootContext, RootContextFlags, TVIEW} from './interfaces/view';
import {publishDefaultGlobalUtils} from './publish_global_util';
import {enterView, leaveView, resetComponentState} from './state';
import {defaultScheduler, getRootView, readElementValue, readPatchedLViewData, stringify} from './util';

View File

@ -7,6 +7,7 @@
*/
import {global} from '../util';
import {getComponent, getDirectives, getHostComponent, getInjector, getRootComponents} from './discovery_utils';
import {getPlayers} from './players';
/**
* This file introduces series of globally accessible debug tools
@ -41,6 +42,7 @@ export function publishDefaultGlobalUtils() {
publishGlobalUtil('getInjector', getInjector);
publishGlobalUtil('getRootComponents', getRootComponents);
publishGlobalUtil('getDirectives', getDirectives);
publishGlobalUtil('getPlayers', getPlayers);
}
}

View File

@ -6,11 +6,12 @@
* found in the LICENSE file at https://angular.io/license
*/
import {getComponent, getDirectives, getHostComponent, getInjector, getRootComponents} from '../../src/render3/discovery_utils';
import {GLOBAL_PUBLISH_EXPANDO_KEY, GlobalDevModeContainer, publishDefaultGlobalUtils, publishGlobalUtil} from '../../src/render3/publish_global_util';
import {GLOBAL_PUBLISH_EXPANDO_KEY, GlobalDevModeContainer, publishDefaultGlobalUtils, publishGlobalUtil} from '../../src/render3/global_utils';
import {global} from '../../src/util';
import {getPlayers} from '../../src/render3/players';
describe('dev mode utils', () => {
describe('devModePublish', () => {
describe('global utils', () => {
describe('publishGlobalUtil', () => {
it('should publish a function to the window', () => {
const w = global as any as GlobalDevModeContainer;
expect(w[GLOBAL_PUBLISH_EXPANDO_KEY]['foo']).toBeFalsy();
@ -34,6 +35,8 @@ describe('dev mode utils', () => {
() => { assertPublished('getHostComponent', getHostComponent); });
it('should publish getInjector', () => { assertPublished('getInjector', getInjector); });
it('should publish getPlayers', () => { assertPublished('getPlayers', getPlayers); });
});
});