initializer.ts 750 B

1234567891011121314151617181920
  1. import { DefaultViewer } from './viewer/defaultViewer';
  2. import { mapperManager } from './configuration/mappers';
  3. /**
  4. * Select all HTML tags on the page that match the selector and initialize a viewer
  5. *
  6. * @param selector the selector to initialize the viewer on (default is 'babylon')
  7. */
  8. export function InitTags(selector: string = 'babylon') {
  9. let elements = document.querySelectorAll(selector);
  10. for (let i = 0; i < elements.length; ++i) {
  11. let element: HTMLElement = <HTMLElement>elements.item(i);
  12. // get the html configuration
  13. let configMapper = mapperManager.getMapper('dom');
  14. let config = configMapper.map(element);
  15. let viewer = new DefaultViewer(element, config);
  16. }
  17. }