MCPcopy Create free account
hub / github.com/WhiteSevs/TamperMonkeyScript / asyncQueryProperty

Method asyncQueryProperty

lib/Utils/src/Utils.ts:3941–3973  ·  view source on GitHub ↗

* 异步-深度获取对象属性 * @param target 待获取的对象 * @param handler 获取属性的回调 * @example * Utils.asyncQueryProperty(window, async (target)=>{ * if(target.xxx){ * return { * isFind: true, * data: target.xxx, * } * }else{ * return { * isFind: false

(
    target: any,
    handler: (
      /**
       * 该值为返回的data值
       */
      target: T
    ) => IPromise<{
      /**
       * 是否是需要的属性
       * + true 将目标值赋值给data
       * + false 不是需要的,data为下一个处理的对象
       */
      isFind: boolean;
      /**
       * 对象/目标值
       *
       * 若`isFind`为true,那该值为返回的结果
       *
       * 若`isFind`为false,那该值为下次迭代传入的`target`
       */
      data: T | R | null | void;
    }>
  )

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls 1

handlerFunction · 0.50

Tested by

no test coverage detected