當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript task.runTask函數代碼示例

本文整理匯總了TypeScript中@jonggrang/task.runTask函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript runTask函數的具體用法?TypeScript runTask怎麽用?TypeScript runTask使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了runTask函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: done

 pendingWrites.onceZero(() => {
   T.runTask(T.forInPar_(uploadedFiles, file => storage.removeFile(file)), (err) => {
     /* istanbul ignore if */
     if (err) return done(err);
     done(uploadError);
   });
 });
開發者ID:syaiful6,項目名稱:jonggrang,代碼行數:7,代碼來源:parser.ts

示例2: removePlaceholder

      T.runTask(fileFilter(ctx, file), (err, includeFile) => {
        if (err) {
          removePlaceholder(files, placeholder);
          return abortWithError(err);
        }

        if (!includeFile) {
          removePlaceholder(files, placeholder);
          return filestream.resume();
        }

        let aborting = false;
        pendingWrites.increment();

        filestream.on('error', (err) => {
          pendingWrites.decrement();
          abortWithError(err);
        });

        filestream.on('limit', function () {
          aborting = true;
          abortWithCode('LIMIT_FILE_SIZE', fieldname);
        });

        T.runTask(storage.handleFile(file, filestream as any), (err, finfo) => {
          // sometimes the limit event was fired before we attach the listener
          // so, check the truncated property here
          if ((filestream as any).truncated && !aborting) filestream.emit('limit');

          if (aborting) {
            removePlaceholder(files, placeholder);
            uploadedFiles.push(assign(file, finfo || {}) as any);
            return pendingWrites.decrement();
          }

          if (err) {
            removePlaceholder(files, placeholder);
            pendingWrites.decrement();
            return abortWithError(err);
          }

          replacePlaceholder(files, placeholder, finfo as any);
          uploadedFiles.push(finfo as any);
          pendingWrites.decrement();
          indicateDone();
        });
      });
開發者ID:syaiful6,項目名稱:jonggrang,代碼行數:47,代碼來源:parser.ts

示例3: mutter

    (form as any).getLength((err: Error | null, len: number) => {
      if (err) return cb(err);

      const app = mutter(simpleApp);
      const request = new PassThrough();
      (request as any).complete = false;
      form.once('end', () => {
        (request as any).complete = true;
      });

      form.pipe(request);
      (request as any).headers = {
        'content-type': 'multipart/form-data; boundary=' + (form as any).getBoundary(),
        'content-length': len
      };

      const ctx: W.HttpContext = W.createHttpContext(request as any);

      T.runTask(app(ctx, T.pure), err => {
        if (err) return cb(err);

        cb(null, ctx);
      });
    });
開發者ID:syaiful6,項目名稱:jonggrang,代碼行數:24,代碼來源:utils.ts

示例4: insertPlaceholder

    busboy.on('file', (fieldname, filestream, originalname, encoding, mimeType) => {
      if (!fieldname) return filestream.resume();

      // Work around bug in Busboy (https://github.com/mscdex/busboy/issues/6)
      if (limits && limits.hasOwnProperty('fieldNameSize')) {
        if (fieldname.length > (limits as any).fieldNameSize) return abortWithCode('LIMIT_FIELD_KEY');
      }

      const file: FileUpload = {
        fieldname,
        originalname,
        encoding,
        mimeType
      };
      const placeholder = insertPlaceholder(files, file);

      T.runTask(fileFilter(ctx, file), (err, includeFile) => {
        if (err) {
          removePlaceholder(files, placeholder);
          return abortWithError(err);
        }

        if (!includeFile) {
          removePlaceholder(files, placeholder);
          return filestream.resume();
        }

        let aborting = false;
        pendingWrites.increment();

        filestream.on('error', (err) => {
          pendingWrites.decrement();
          abortWithError(err);
        });

        filestream.on('limit', function () {
          aborting = true;
          abortWithCode('LIMIT_FILE_SIZE', fieldname);
        });

        T.runTask(storage.handleFile(file, filestream as any), (err, finfo) => {
          // sometimes the limit event was fired before we attach the listener
          // so, check the truncated property here
          if ((filestream as any).truncated && !aborting) filestream.emit('limit');

          if (aborting) {
            removePlaceholder(files, placeholder);
            uploadedFiles.push(assign(file, finfo || {}) as any);
            return pendingWrites.decrement();
          }

          if (err) {
            removePlaceholder(files, placeholder);
            pendingWrites.decrement();
            return abortWithError(err);
          }

          replacePlaceholder(files, placeholder, finfo as any);
          uploadedFiles.push(finfo as any);
          pendingWrites.decrement();
          indicateDone();
        });
      });
    });
開發者ID:syaiful6,項目名稱:jonggrang,代碼行數:64,代碼來源:parser.ts

示例5: it

 it(desc, done => {
   T.runTask(testRunner(headers, fp, rsp), done);
 });
開發者ID:syaiful6,項目名稱:jonggrang,代碼行數:3,代碼來源:file.test.ts


注:本文中的@jonggrang/task.runTask函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。