Minor Changes
-
refactor: remove web-elements/lazy and loadNewTag (#123)
- remove @lynx-js/web-elements/lazy
- remove loadElement
- remove loadNewTag callback
This is a breaking change
Now we removed the default lazy loading preinstalled in web-core
Please add the following statement in your web project
import "@lynx-js/web-elements/all";
Patch Changes
-
feat: add pixelRatio of SystemInfo, now you can use
SystemInfo.pixelRatio
. (#150) -
feat: add two prop of lynx-view about
napiLoader
: (#173)-
napiModulesMap
: [optional] the napiModule which is called in lynx-core. key is module-name, value is esm url. -
onNapiModulesCall
: [optional] the NapiModule value handler.
Warning: This is the internal implementation of
@lynx-js/lynx-core
. In most cases, this API is not required for projects.- The
napiModulesMap
value should be a esm url which export default a function with two parameters:
-
NapiModules
: orientednapiModulesMap
, which you can use to call other Napi-Modules -
NapiModulesCall
: triggeronNapiModulesCall
example:
const color_environment = URL.createObjectURL( new Blob( [ `export default function(NapiModules, NapiModulesCall) { return { getColor() { NapiModules.color_methods.getColor({ color: 'green' }, color => { console.log(color); }); }, ColorEngine: class ColorEngine { getColor(name) { NapiModules.color_methods.getColor({ color: 'green' }, color => { console.log(color); }); } }, }; };`, ], { type: 'text/javascript' }, ), ); const color_methods = URL.createObjectURL( new Blob( [ `export default function(NapiModules, NapiModulesCall) { return { async getColor(data, callback) { const color = await NapiModulesCall('getColor', data); callback(color); }, }; };`, ], { type: 'text/javascript' }, ), ); lynxView.napiModuleMap = { color_environment: color_environment, color_methods: color_methods, };
- The
onNapiModulesCall
function has three parameters:
name
: the first parameter ofNapiModulesCall
, the function namedata
: the second parameter ofNapiModulesCall
, datamoduleName
: the module-name of the called napi-module
lynxView.onNapiModulesCall = (name, data, moduleName) => { if (name === 'getColor' && moduleName === 'color_methods') { return data.color; } };
-
-
Updated dependencies [
e9e8370
,ec4e1ce
,f0a717c
,63fab7b
]:- @lynx-js/web-mainthread-apis@0.8.0
- @lynx-js/web-constants@0.8.0
- @lynx-js/web-worker-rpc@0.8.0