Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ray-js/rjs-for-wechat

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ray-js/rjs-for-wechat - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

65

index.js
function query(selector, m, ctx) {
return wx.createSelectorQuery().in(ctx._ctx)
[m](selector)
.fields({
node: true,
size: true,
})
return wx.createSelectorQuery().in(ctx._ctx)[m](selector);
}
function getCanvasById (id, ctx){
return new Promise((resolve, reject) => query(`#${id}`, 'select', ctx).exec(res => resolve(res[0]?.node)))
function fields(noderef, args = { node: true, size: true }) {
return noderef.fields(args);
}
const Render = function (args) {
function fn(ctx){
this._ctx = ctx
}
fn.prototype = Object.create(args)
return fn
function getCanvasById(id, ctx) {
return new Promise((resolve) =>
fields(query(`#${id}`, "select", ctx)).exec((res) => resolve(res[0]?.node))
);
}
const getSystemInfo = function(){
return wx.getSystemInfoSync()
}
const Render = function (args) {
function fn(ctx) {
this._ctx = ctx;
}
fn.prototype = Object.create(args);
return fn;
};
const getViewNodes = function(selector, ctx) {
return new Promise((resolve, reject) => query(selector, 'selectAll', ctx).exec(res => resolve(res[0])))
}
const getSystemInfo = function () {
return wx.getSystemInfoSync();
};
const getBoundingClientRectById = function(id, ctx){
return new Promise((resolve) => query(`#${id}`, 'select', ctx).boundingClientRect(res => resolve(res)).exec())
}
const getViewNodes = function (selector, ctx) {
return new Promise((resolve, reject) =>
fields(query(selector, "selectAll", ctx)).exec((res) => resolve(res[0]))
);
};
const getBoundingClientRectById = function (id, ctx) {
return new Promise((resolve) =>
query(`#${id}`, "select", ctx)
.boundingClientRect((res) => resolve(res))
.exec()
);
};
module.exports = {
Render,
getCanvasById,
getSystemInfo,
getViewNodes,
getBoundingClientRectById
}
Render,
getCanvasById,
getSystemInfo,
getViewNodes,
getBoundingClientRectById,
};
{
"name": "@ray-js/rjs-for-wechat",
"main": "index.js",
"version": "0.0.1"
}
"version": "0.0.2"
}

@@ -1,1 +0,4 @@

rjs(render javascript script) 只在视图层执行的脚本
### rjs(render javascript script):
A rendering script can be used to handle frequent drawing tasks and improve the animation rendering performance at the view layer.
You can get more information on our official website: https://developer.tuya.com/en/miniapp/framework/api/render
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc