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";
-
feat: use shadowroot to isolate one lynx-view (#198)
Before this commit, we have been detecting if current browser supports the
@scope
rule.
This allows us to scope one lynx-view's styles.After this commit we always create a shadowroot to scope then.
Also for the new shadowroot pattern, we add a new attribute
inject-head-links
.
By default, we will iterate all<link rel="stylesheet">
in the<head>
, and use@import url()
to import them inside the shadowroot.
Developers could add ainject-head-links="false"
to disable this behavior. -
feat: never add the x-enable-xx-event attributes (#157)
After this commit, we update the reqirement of the version of
@lynx-js/web-elements
to>=0.3.1
Patch Changes
-
feat: add pixelRatio of SystemInfo, now you can use
SystemInfo.pixelRatio
. (#150) -
Improve LynxView resize observer cleanup (#124)
-
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 [
eab1328
,e9e8370
,ec4e1ce
,f0a717c
]:- @lynx-js/web-worker-runtime@0.8.0
- @lynx-js/web-constants@0.8.0
- @lynx-js/web-worker-rpc@0.8.0