MCPcopy Create free account
hub / github.com/decodecaptcha/Browser-Env / bind

Method bind

jsenv/nodeenv/execjs.py:159–175  ·  view source on GitHub ↗

Return an partial of `.exec`, with `node` set to :obj:`.node`, and `js` set to current javascripts in queue: (setup + run + post). :param expr: Optional. If given, the expression will be added to :obj:`.run`.

(self, expr: Optional[JsExpr] = None)

Source from the content-addressed store, hash-verified

157 return removesuffix(stdout.decode())
158
159 def bind(self, expr: Optional[JsExpr] = None):
160 """Return an partial of `.exec`, with `node` set to :obj:`.node`,
161 and `js` set to current javascripts in queue: (setup + run + post).
162
163 :param expr: Optional. If given, the expression will be added to :obj:`.run`.
164 """
165 js = ""
166 if expr is None:
167 pass
168 elif isinstance(expr, Partial):
169 self.add_run("console.log", expr)
170 else:
171 self.run.append(f"console.log({expr})")
172 for expr in chain(self.setup, self.run, self.post):
173 js += str(expr)
174 js += ";"
175 return partial(self.exec, node=self.node, js=js)
176
177 # async def __call__(self, expr: Optional[JsExpr]):
178 # """Run current javascripts. :obj:`.run` will be cleared.

Callers 1

__call__Method · 0.95

Calls 1

add_runMethod · 0.95

Tested by

no test coverage detected