TypeScript @angular-core-src-facade-promise.PromiseWrapper类(方法)实例源码

下面列出了TypeScript @angular-core-src-facade-promise.PromiseWrapper 类(方法)源码代码实例,从而了解它的用法。

作者:Hongbo-Mia    项目:angular2-meteor-universa   
get(templateUrl: string): Promise<string> {
    const completer: PromiseCompleter<string> = PromiseWrapper.completer();
    const fullPath = path.join(this.assetsPath, templateUrl);
    this.ngZone.run(() => {
      fs.readFile(fullPath, (err, data) => {
        if (err) {
          return completer.reject(`Failed to load ${templateUrl} with error ${err}`);
        }

        this.ngZone.run(() => {
          completer.resolve(data.toString());
        });
      });
    });
    return completer.promise;
  }

作者:Shawn999    项目:angular2-moda   
constructor(public context?: T) {
     this._resultDeferred = PromiseWrapper.completer();
 }

作者:andela-jmwang    项目:angular2-moda   
constructor(public config: ModalConfig) {
     this._resultDeferred = PromiseWrapper.completer();
 }


问题


面经


文章

微信
公众号

扫码关注公众号