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


TypeScript path.contains方法代码示例

本文整理汇总了TypeScript中tree.path.contains方法的典型用法代码示例。如果您正苦于以下问题:TypeScript path.contains方法的具体用法?TypeScript path.contains怎么用?TypeScript path.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tree.path的用法示例。


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

示例1: throttle

 var getDests = throttle(800, function() {
   if (!vm.node.dests && treePath.contains(vm.path, vm.initialPath))
     socket.sendAnaDests({
       fen: vm.node.fen,
       path: vm.path
     });
 });
开发者ID:ddugovic,项目名称:lila,代码行数:7,代码来源:ctrl.ts

示例2: nodeClasses

export function nodeClasses(ctx: Ctx, path: Tree.Path): NodeClasses {
  return {
    active: path === ctx.ctrl.path,
    context_menu: path === ctx.ctrl.contextMenuPath,
    current: path === ctx.currentPath,
    nongame: !ctx.currentPath && !!ctx.ctrl.gamePath && treePath.contains(path, ctx.ctrl.gamePath) && path !== ctx.ctrl.gamePath
  };
}
开发者ID:ddugovic,项目名称:lila,代码行数:8,代码来源:treeView.ts

示例3: h

 return h('lines', nodes.map(n => {
   return retroLine(ctx, n, opts) || h('line', renderMoveAndChildrenOf(ctx, n, {
     parentPath: opts.parentPath,
     isMainline: false,
     withIndex: true,
     truncate: n.comp && !treePath.contains(ctx.ctrl.path, opts.parentPath + n.id) ? 3 : undefined
   }));
 }));
开发者ID:ddugovic,项目名称:lila,代码行数:8,代码来源:inlineView.ts

示例4: nodeClasses

export function nodeClasses(c: AnalyseCtrl, path: Tree.Path): NodeClasses {
  const current = (path === c.initialPath && game.playable(c.data)) || (
    c.retro && c.retro.current() && c.retro.current().prev.path === path
  );
  return {
    active: path === c.path,
    context_menu: path === c.contextMenuPath,
    current,
    nongame: !current && !!c.gamePath && treePath.contains(path, c.gamePath) && path !== c.gamePath
  };
}
开发者ID:lexisvar,项目名称:lila,代码行数:11,代码来源:treeView.ts

示例5: function

  return function() {

    if (vm.mode === 'view') return;
    if (!pathOps.contains(vm.path, vm.initialPath)) return;

    var playedByColor = vm.node.ply % 2 === 1 ? 'white' : 'black';
    if (playedByColor !== puzzle.color) return;

    var nodes = vm.nodeList.slice(pathOps.size(vm.initialPath) + 1).map(function(node) {
      return {
        uci: node.uci,
        castle: node.san.startsWith('O-O')
      };
    });

    var progress = puzzle.lines;
    for (var i in nodes) {
      if (progress[nodes[i].uci]) progress = progress[nodes[i].uci];
      else if (nodes[i].castle) progress = progress[altCastles[nodes[i].uci]] || 'fail';
      else progress = 'fail';
      if (typeof progress === 'string') break;
    }
    if (typeof progress === 'string') {
      vm.node.puzzle = progress;
      return progress;
    }

    var nextKey = Object.keys(progress)[0]
      if (progress[nextKey] === 'win') {
        vm.node.puzzle = 'win';
        return 'win';
      }

      // from here we have a next move

      vm.node.puzzle = 'good';

    var opponentUci = decomposeUci(nextKey);
    var promotion = opponentUci[2] ? sanToRole[opponentUci[2].toUpperCase()] : null;

    var move: any = {
      orig: opponentUci[0],
      dest: opponentUci[1],
      fen: vm.node.fen,
      path: vm.path
    };
    if (promotion) move.promotion = promotion;

    return move;
  };
开发者ID:ornicar,项目名称:lila,代码行数:50,代码来源:moveTest.ts

示例6: first

export function first(ctrl) {
  var toInit = ctrl.vm.path !== ctrl.vm.initialPath && treePath.contains(ctrl.vm.path, ctrl.vm.initialPath);
  ctrl.userJump(
    toInit ? ctrl.vm.initialPath : treePath.root
  );
}
开发者ID:ddugovic,项目名称:lila,代码行数:6,代码来源:control.ts

示例7: last

export function last(ctrl) {
  var toInit = !treePath.contains(ctrl.vm.path, ctrl.vm.initialPath);
  ctrl.userJump(
    toInit ? ctrl.vm.initialPath : treePath.fromNodeList(ctrl.vm.mainline)
  );
}
开发者ID:ddugovic,项目名称:lila,代码行数:6,代码来源:control.ts

示例8: function


//.........这里部分代码省略.........
    obj.path = ctrl.path;
    return obj;
  }

  return {
    data,
    form,
    members,
    chapters,
    notif,
    commentForm,
    glyphForm,
    share,
    tags,
    desc,
    vm,
    isUpdatedRecently() {
      return Date.now() - vm.updatedAt < 300 * 1000;
    },
    toggleLike() {
      send("like", {
        liked: !data.liked
      });
    },
    position() {
      return data.position;
    },
    currentChapter,
    isChapterOwner,
    canJumpTo(path: Tree.Path) {
      if (gamebookPlay) return gamebookPlay.canJumpTo(path);
      return data.chapter.conceal === undefined ||
        isChapterOwner() ||
        treePath.contains(ctrl.path, path) || // can always go back
        ctrl.tree.lastMainlineNode(path).ply <= data.chapter.conceal!;
    },
    onJump() {
      chapters.localPaths[vm.chapterId] = ctrl.path;
      if (practice) practice.onJump();
      if (gamebookPlay) gamebookPlay.onJump();
    },
    withPosition,
    setPath(path, node) {
      onSetPath(path);
      setTimeout(() => commentForm.onSetPath(path, node), 100);
    },
    deleteNode(path) {
      makeChange("deleteNode", addChapterId({
        path,
        jumpTo: ctrl.path
      }));
    },
    promote(path, toMainline) {
      makeChange("promote", addChapterId({
        toMainline,
        path
      }));
    },
    setChapter(id, force) {
      if (id === vm.chapterId && !force) return;
      if (!vm.mode.sticky || !makeChange("setChapter", id)) {
        vm.mode.sticky = false;
        if (!vm.behind) vm.behind = 1;
        vm.chapterId = id;
        xhrReload();
      }
开发者ID:lexisvar,项目名称:lila,代码行数:67,代码来源:studyCtrl.ts

示例9: pathContains

function pathContains(ctx, path) {
  return treePath.contains(ctx.ctrl.vm.path, path);
}
开发者ID:ornicar,项目名称:lila,代码行数:3,代码来源:tree.ts

示例10: function

 return function(path: Tree.Path, node: Tree.Node) {
   if (!conceal || (isMainline && conceal.ply >= node.ply)) return null;
   if (treePath.contains(ctrl.path, path)) return null;
   return conceal.owner ? 'conceal' : 'hide';
 };
开发者ID:luanlv,项目名称:lila,代码行数:5,代码来源:view.ts


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