@lynx-js/web-core
Version:
This is an internal experimental package, do not use
24 lines • 914 B
JavaScript
// Copyright 2023 The Lynx Authors. All rights reserved.
// Licensed under the Apache License Version 2.0 that can be found in the
// LICENSE file in the root directory of this source tree.
import { invokeUIMethodEndpoint } from '../../../endpoints.js';
import { ErrorCode } from '../../../../constants.js';
export function createInvokeUIMethod(rpc) {
return (type, identifier, component_id, method, params, callback, root_unique_id) => {
rpc.invoke(invokeUIMethodEndpoint, [
type,
identifier,
component_id,
method,
params,
root_unique_id,
]).then(callback).catch((error) => {
console.error(`[lynx-web] invokeUIMethod failed`, error);
callback({
code: ErrorCode.UNKNOWN,
data: '',
});
});
};
}
//# sourceMappingURL=createInvokeUIMethod.js.map