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


TypeScript lang.isBlank函数代码示例

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


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

示例1: _extractUrl

// Extracts the url from an import rule, supported formats:
// - 'url' / "url",
// - url(url) / url('url') / url("url")
function _extractUrl(importRule: string): string {
  var match = RegExpWrapper.firstMatch(_urlRe, importRule);
  if (isBlank(match)) return null;
  return isPresent(match[1]) ? match[1] : match[2];
}
开发者ID:tavwizard,项目名称:angular,代码行数:8,代码来源:style_inliner.ts

示例2: _withCssRules

function _withCssRules(cssText: string, callback: Function) {
  // Difference from webcomponentjs: remove the workaround for an old bug in Chrome
  if (isBlank(callback)) return;
  var rules = _cssToRules(cssText);
  callback(rules);
}
开发者ID:adamdbradley,项目名称:angular,代码行数:6,代码来源:shadow_css.ts

示例3: eval

 eval(context, locals: Locals): any {
   var evaluatedReceiver = this.receiver.eval(context, locals);
   if (isBlank(evaluatedReceiver)) return null;
   var evaluatedArgs = evalList(context, locals, this.args);
   return this.fn(evaluatedReceiver, evaluatedArgs);
 }
开发者ID:cedriclam,项目名称:angular,代码行数:6,代码来源:ast.ts

示例4: browserPlatform

export function browserPlatform(): PlatformRef {
  if (isBlank(getPlatform())) {
    createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PROVIDERS));
  }
  return assertPlatform(BROWSER_PLATFORM_MARKER);
}
开发者ID:JavaScript-Resource,项目名称:angular,代码行数:6,代码来源:browser.ts

示例5: isDefaultChangeDetectionStrategy

export function isDefaultChangeDetectionStrategy(
    changeDetectionStrategy: ChangeDetectionStrategy): boolean {
  return isBlank(changeDetectionStrategy) ||
         changeDetectionStrategy === ChangeDetectionStrategy.Default;
}
开发者ID:MingXingTeam,项目名称:awesome-front-end,代码行数:5,代码来源:constants.ts

示例6: _inlineImports

  _inlineImports(cssText: string, baseUrl: string, inlinedUrls: List<string>): Promise<string>|string {
    var partIndex = 0;
    var parts = StringWrapper.split(cssText, _importRe);

    if (parts.length === 1) {
      // no @import rule found, return the original css
      return cssText;
    }

    var promises = [];

    while (partIndex < parts.length - 1) {
      // prefix is the content before the @import rule
      var prefix = parts[partIndex];
      // rule is the parameter of the @import rule
      var rule = parts[partIndex + 1];
      var url = _extractUrl(rule);
      if (isPresent(url)) {
        url = this._urlResolver.resolve(baseUrl, url);
      }
      var mediaQuery = _extractMediaQuery(rule);
      var promise;

      if (isBlank(url)) {
        promise = PromiseWrapper.resolve(`/* Invalid import rule: "@import ${rule};" */`);
      } else if (ListWrapper.contains(inlinedUrls, url)) {
        // The current import rule has already been inlined, return the prefix only
        // Importing again might cause a circular dependency
        promise = PromiseWrapper.resolve(prefix);
      } else {
        ListWrapper.push(inlinedUrls, url);
        promise = PromiseWrapper.then(
          this._xhr.get(url),
          (css) => {
            // resolve nested @import rules
            css = this._inlineImports(css, url, inlinedUrls);
            if (PromiseWrapper.isPromise(css)) {
              // wait until nested @import are inlined
              return css.then((css) => {
                return prefix + this._transformImportedCss(css, mediaQuery, url) + '\n'
              }) ;
            } else {
              // there are no nested @import, return the css
              return prefix + this._transformImportedCss(css, mediaQuery, url) + '\n';
            }
          },
          (error) => `/* failed to import ${url} */\n`
        );
      }
      ListWrapper.push(promises, promise);
      partIndex += 2;
    }

    return PromiseWrapper.all(promises).then(function (cssParts) {
      var cssText = cssParts.join('');
      if (partIndex < parts.length) {
        // append then content located after the last @import rule
        cssText += parts[partIndex];
      }
      return cssText;
    });
  }
开发者ID:tavwizard,项目名称:angular,代码行数:62,代码来源:style_inliner.ts

示例7: _createView

 _createView(protoView) {
   var rootElementClone = protoView.isRootView ? protoView.element : DOM.importIntoDoc(protoView.element);
   var elementsWithBindingsDynamic;
   if (protoView.isTemplateElement) {
     elementsWithBindingsDynamic = DOM.querySelectorAll(DOM.content(rootElementClone), NG_BINDING_CLASS_SELECTOR);
   } else {
     elementsWithBindingsDynamic = DOM.getElementsByClassName(rootElementClone, NG_BINDING_CLASS);
   }
   var elementsWithBindings = ListWrapper.createFixedSize(elementsWithBindingsDynamic.length);
   for (var binderIdx = 0; binderIdx < elementsWithBindingsDynamic.length; ++binderIdx) {
     elementsWithBindings[binderIdx] = elementsWithBindingsDynamic[binderIdx];
   }
   var viewRootNodes;
   if (protoView.isTemplateElement) {
     var childNode = DOM.firstChild(DOM.content(rootElementClone));
     viewRootNodes = [];
     while (childNode != null) {
       ListWrapper.push(viewRootNodes, childNode);
       childNode = DOM.nextSibling(childNode);
     }
   } else {
     viewRootNodes = [rootElementClone];
   }
   var binders = protoView.elementBinders;
   var boundTextNodes = [];
   var boundElements = ListWrapper.createFixedSize(binders.length);
   var viewContainers = ListWrapper.createFixedSize(binders.length);
   var contentTags = ListWrapper.createFixedSize(binders.length);
   for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) {
     var binder = binders[binderIdx];
     var element;
     if (binderIdx === 0 && protoView.rootBindingOffset === 1) {
       element = rootElementClone;
     } else {
       element = elementsWithBindings[binderIdx - protoView.rootBindingOffset];
     }
     boundElements[binderIdx] = element;
     var childNodes = DOM.childNodes(DOM.templateAwareRoot(element));
     var textNodeIndices = binder.textNodeIndices;
     for (var i = 0; i < textNodeIndices.length; i++) {
       ListWrapper.push(boundTextNodes, childNodes[textNodeIndices[i]]);
     }
     var viewContainer = null;
     if (isBlank(binder.componentId) && isPresent(binder.nestedProtoView)) {
       viewContainer = new ViewContainer(this, element);
     }
     viewContainers[binderIdx] = viewContainer;
     var contentTag = null;
     if (isPresent(binder.contentTagSelector)) {
       contentTag = new Content(element, binder.contentTagSelector);
     }
     contentTags[binderIdx] = contentTag;
   }
   var view = new View(protoView, viewRootNodes, boundTextNodes, boundElements, viewContainers, contentTags);
   for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) {
     var binder = binders[binderIdx];
     var element = boundElements[binderIdx];
     if (isPresent(binder.componentId) && isPresent(binder.nestedProtoView)) {
       var childView = this._createView(binder.nestedProtoView);
       view.setComponentView(this._shadowDomStrategy, binderIdx, childView);
     }
     if (isPresent(binder.eventLocals)) {
       ListWrapper.forEach(binder.eventNames, (eventName) => {
         this._createEventListener(view, element, binderIdx, eventName, binder.eventLocals);
       });
     }
   }
   if (protoView.isRootView) {
     view.hydrate(null);
   }
   return view;
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:72,代码来源:view_factory.ts

示例8: isDefaultChangeDetection

 isDefaultChangeDetection(): boolean {
   return isBlank(this.directiveRecord) || this.directiveRecord.isDefaultChangeDetection();
 }
开发者ID:0oAimZo0,项目名称:Angular2Learning,代码行数:3,代码来源:binding_record.ts

示例9: toHtml

function toHtml(nodes) {
  if (isBlank(nodes))
    return [];
  return ListWrapper.map(nodes, DOM.getOuterHTML);
}
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:5,代码来源:light_dom_spec.ts

示例10: expectEvalError

 function expectEvalError(text, passedInContext = null, passedInLocals = null) {
   var c = isBlank(passedInContext) ? td() : passedInContext;
   var l = isBlank(passedInLocals) ? emptyLocals() : passedInLocals;
   return expect(() => parseAction(text).eval(c, l));
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:5,代码来源:parser_spec.ts


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