MCPcopy Create free account
hub / github.com/PyQt5/PyQt / addMethod

Function addMethod

QWebEngineView/Data/qwebchannel.js:325–358  ·  view source on GitHub ↗
(methodData)

Source from the content-addressed store, hash-verified

323 }
324
325 function addMethod(methodData)
326 {
327 var methodName = methodData[0];
328 var methodIdx = methodData[1];
329 object[methodName] = function() {
330 var args = [];
331 var callback;
332 for (var i = 0; i < arguments.length; ++i) {
333 var argument = arguments[i];
334 if (typeof argument === "function")
335 callback = argument;
336 else if (argument instanceof QObject && webChannel.objects[argument.__id__] !== undefined)
337 args.push({
338 "id": argument.__id__
339 });
340 else
341 args.push(argument);
342 }
343
344 webChannel.exec({
345 "type": QWebChannelMessageTypes.invokeMethod,
346 "object": object.__id__,
347 "method": methodIdx,
348 "args": args
349 }, function(response) {
350 if (response !== undefined) {
351 var result = object.unwrapQObject(response);
352 if (callback) {
353 (callback)(result);
354 }
355 }
356 });
357 };
358 }
359
360 function bindGetterSetter(propertyInfo)
361 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected