当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript browser_adapter.BrowserDomAdapter类代码示例

本文整理汇总了TypeScript中@angular/platform-browser/src/browser/browser_adapter.BrowserDomAdapter的典型用法代码示例。如果您正苦于以下问题:TypeScript BrowserDomAdapter类的具体用法?TypeScript BrowserDomAdapter怎么用?TypeScript BrowserDomAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BrowserDomAdapter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

  constructor(elementRef:ElementRef, private dom:BrowserDomAdapter) {
    this.$element = elementRef.nativeElement;

    // initial styling
    this.dom.setStyle(this.$element, 'position', 'absolute');
    this.dom.setStyle(this.$element, 'top', '0');
    this.dom.setStyle(this.$element, 'bottom', '0');
    this.dom.setStyle(this.$element, 'max-height', '100%');
  }
开发者ID:ajeetkanojia,项目名称:ReDoc,代码行数:9,代码来源:sticky-sidebar.ts

示例2: init

  function init() {
    BrowserDomAdapter.makeCurrent();
    const tree = document.createElement('tree');
    document.querySelector('baseline').appendChild(tree);
    app = new BaseLineTreeComponent(tree);

    bindAction('#destroyDom', destroyDom);
    bindAction('#createDom', createDom);

    bindAction('#updateDomProfile', profile(createDom, noop, 'baseline-update'));
    bindAction('#createDomProfile', profile(createDom, destroyDom, 'baseline-create'));
  }
开发者ID:xavier268,项目名称:angular,代码行数:12,代码来源:index.ts

示例3: main

export function main() {
  BrowserDomAdapter.makeCurrent();
  var count = getIntParameter('selectors');

  var fixedMatcher;
  var fixedSelectorStrings = [];
  var fixedSelectors = [];
  for (var i = 0; i < count; i++) {
    fixedSelectorStrings.push(randomSelector());
  }
  for (var i = 0; i < count; i++) {
    fixedSelectors.push(CssSelector.parse(fixedSelectorStrings[i]));
  }
  fixedMatcher = new SelectorMatcher();
  for (var i = 0; i < count; i++) {
    fixedMatcher.addSelectables(fixedSelectors[i], i);
  }

  function parse() {
    var result = [];
    for (var i = 0; i < count; i++) {
      result.push(CssSelector.parse(fixedSelectorStrings[i]));
    }
    return result;
  }

  function addSelectable() {
    var matcher = new SelectorMatcher();
    for (var i = 0; i < count; i++) {
      matcher.addSelectables(fixedSelectors[i], i);
    }
    return matcher;
  }

  function match() {
    var matchCount = 0;
    for (var i = 0; i < count; i++) {
      fixedMatcher.match(fixedSelectors[i][0], (selector, selected) => { matchCount += selected; });
    }
    return matchCount;
  }

  bindAction('#parse', parse);
  bindAction('#addSelectable', addSelectable);
  bindAction('#match', match);
}
开发者ID:0xJoKe,项目名称:angular,代码行数:46,代码来源:selector_benchmark.ts

示例4: autoInit

 static autoInit() {
   const specUrlAttributeName = 'spec-url';
   let redocEl = dom.query('redoc');
   if (!redocEl) return;
   if (dom.hasAttribute(redocEl, specUrlAttributeName)) {
     let url = dom.getAttribute(redocEl, specUrlAttributeName);
     Redoc.init(url);
   }
 }
开发者ID:ajeetkanojia,项目名称:ReDoc,代码行数:9,代码来源:redoc.ts

示例5: hideLoadingAnimation

 static hideLoadingAnimation() {
   let redocEl = dom.query('redoc');
   if (!redocEl) return;
   dom.addClass(redocEl, 'loading-remove');
   setTimeout(() => {
     dom.removeClass(redocEl, 'loading-remove');
     dom.removeClass(redocEl, 'loading');
   }, 400);
 }
开发者ID:ajeetkanojia,项目名称:ReDoc,代码行数:9,代码来源:redoc.ts

示例6: init

  init() {
    this.categories = this.menuService.categories;

    this.$mobileNav = this.dom.querySelector(this.$element, '.mobile-nav');
    this.$resourcesNav = this.dom.querySelector(this.$element, '#resources-nav');

    //decorate scrollYOffset to account mobile nav
    this.scrollService.scrollYOffset = () => {
      let mobileNavOffset = this.$mobileNav.clientHeight;
      return this.options.scrollYOffset() + mobileNavOffset;
    };
  }
开发者ID:ajeetkanojia,项目名称:ReDoc,代码行数:12,代码来源:side-menu.ts

示例7: setupToggleAria

  setupToggleAria() {
    let toggleTypes = ['md-switch', 'md-checkbox'];
    let toggle;
    let el = this._element.nativeElement;

    for (var i = 0, toggleType; toggleType = toggleTypes[i]; ++i) {
      if (toggle = this.dom.querySelector(el, toggleType)) {
        if (!toggle.hasAttribute('aria-label')) {
          var p = this.dom.querySelector(el, 'p');
          if (!p) return;
          toggle.setAttribute('aria-label', 'Toggle ' + p.textContent);
        }
      }
    }
  }
开发者ID:robwafle,项目名称:ng2-material,代码行数:15,代码来源:list.ts

示例8: displayError

 static displayError(err) {
   let redocEl = dom.query('redoc');
   if (!redocEl) return;
   let heading = 'Oops... ReDoc failed to render this spec';
   let details = err.message;
   let erroHtml = `<div class="redoc-error">
     <h1>${heading}</h1>
     <div class='redoc-error-details'>${details}</div>`;
   redocEl.innerHTML = erroHtml;
 }
开发者ID:ajeetkanojia,项目名称:ReDoc,代码行数:10,代码来源:redoc.ts

示例9: parseOptions

  parseOptions(el) {
    let parsedOpts;
    let attributesMap = this.dom.attributeMap(el);
    parsedOpts = {};
    Array.from(attributesMap.keys())
      //camelCasify
      .map(k => ({
        attrName: k,
        name: k.replace(/-(.)/g,  (m, $1) => $1.toUpperCase())
        })
      )
      .filter(option => OPTION_NAMES.has(option.name))
      .forEach(option => {
        parsedOpts[option.name] = attributesMap.get(option.attrName);
      });

    this.options = parsedOpts;
    this._normalizeOptions();
  }
开发者ID:ajeetkanojia,项目名称:ReDoc,代码行数:19,代码来源:options.service.ts

示例10: toggleMobileNav

 toggleMobileNav() {
   let dom = this.dom;
   let $overflowParent = (this.options.$scrollParent === global) ? dom.defaultDoc().body
     : this.$scrollParent;
   if (dom.hasStyle(this.$resourcesNav, 'height')) {
     dom.removeStyle(this.$resourcesNav, 'height');
     dom.removeStyle($overflowParent, 'overflow-y');
   } else {
     let viewportHeight = this.options.$scrollParent.innerHeight
      || this.options.$scrollParent.clientHeight;
     let height = viewportHeight - this.$mobileNav.getBoundingClientRect().bottom;
     dom.setStyle($overflowParent, 'overflow-y', 'hidden');
     dom.setStyle(this.$resourcesNav, 'height', height + 'px');
   }
 }
开发者ID:ajeetkanojia,项目名称:ReDoc,代码行数:15,代码来源:side-menu.ts


注:本文中的@angular/platform-browser/src/browser/browser_adapter.BrowserDomAdapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。