cyanzhong / xteko Goto Github PK
View Code? Open in Web Editor NEWJSBox demos
Home Page: https://itunes.apple.com/cn/app/id1312014438
JSBox demos
Home Page: https://itunes.apple.com/cn/app/id1312014438
数组的API全部都有问题
比如
1.打印是空白
2.for循环 拿到数据全部是最后一个
在管理扩展里面,只能修改快捷键,双击也不能编辑。
在添加扩展处,输入相同名称不能显示已有扩展,同名保存提示已经存在拒绝保存。
那么,如何编辑已经保存的 JS扩展?
如题
我看给定的例子里都是class,可以进行实例化
但是CoreMIDI下的都是func,我使用$objc('xxxx')()会提示xxxx不是一个function
还有这方面有其他的参考文档吗,查起来有点没有头绪,感谢!
As JSBox uses node.js, I tried the following script which works fine as is using node on MacOS. Under JSBox it gives the error:
TypeError: express is not a function. (In 'express()', 'express' is an instance of Object)
line 2, column 18
Can anyone tell what is going on? Bug in JSBox?
var express = require('express');
var app = express();
app.get('/', function (req, res) {
var sql = require("mssql");
// config for your database
var config = {
user: 'user',
password: 'pswd',
server: 'host',
database: 'dbname'
};
// connect to your database
sql.connect(config, function (err) {
if (err) console.log(err);
// create Request object
var request = new sql.Request();
// query to the database and get the records
request.query('select * from tablename', function (err, recordset) {
if (err) console.log(err)
// send records as a response
res.send(recordset);
});
});
});
var server = app.listen(5000, function () {
console.log('Server is running..');
});
最新版JSBox Demo中的汇率转换,在JSBOX启动器中,输入后计算结果永远是零,并有一定几率直接闪一下不会出现小窗口。
在JS扩展下,默认例子修改为:
function run() {
return "|text|";
}
可以实现去掉格式。
如何加入将"|text|"
粘贴到当前光标活动的地方的功能?
另外,之前提到的$clipboard.text
也是JS扩展支持的语法吗? 我测试后发现 return $clipboard.text;
没有效果。
form-data类型的参数怎么传?
x-www-form-urlencoded类型的参数怎么传?
用这种方式貌似不好使
$http.post({
url: "xxx",
body: {
cont: "abc",
ppp: "123"
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
handler: function(resp) {
//略
}
});
另外,响应回调怎么获取response headers ?
感觉$include功能不是很完善,我尝试用下面的方法来引用一个远程脚本,但是好像不成功,下载到本地引用好像也不成功,然后试了把路径随便写一个也不报错。。。。。
$include('https://sdk.amazonaws.com/js/aws-sdk-2.418.0.min.js')
另外尝试用require引用node的包会报RangeError:Maximum call stack size exceeded
错误
I wanna use Jsbox to open vpn. Is there someone could help me.
自己写的扩展需要处理一些数据,如果能够引入lodash等扩展库的话将会方便很多
为了GBA买了jsbox,但源代码貌似删掉了,大佬可以给个下载的地方吗。十分感谢
Hi,
JSBox 能否考虑特殊支持code-server?我尝试在iPadOS 上运行代码, code-server是个不错的选择. 然而 iOS/iPadOS Safari 不支持自定义快捷键. 看到JSBox可以自定义快捷键, 这个两个项目的组合可能会产生一个非常亮眼的刚需应用. 请作者考虑.
希望能帮忙写个可以在Pin下用的jsbox的例子,用来将剪贴板的带格式文字,粘贴为纯文本(plain text)。
I wanna write a script to export all installed scripts.
data
is undefined or null for all scripts written manually, scripts saved by $addin.save
work with no problem.
And I wish $addin.list
is a raw js dictionary so that I can dump it directly as a json.
Hi,这个对象好像是 PLXPCShMemData,请问我怎样能获取 gif 的二进制数据?
Is there any way to select the language for $text.speech
like Workflow TTS does?
``
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
var delay = getRandomInt(1, 5);
$push.schedule({
title: "开始工作",
body: "随机延迟: " + delay +"秒",
handler: function(result) {
console.log("pushid:" + result.id);
},
delay: 0.1,
renew: true
})
var localtion = await $location.get();
$push.schedule({
title: "地理位置",
body: localtion.lat + "\r\n" + localtion.lng,
handler: function(result) {
console.log("pushid:" + result.id);
},
delay: 0.1,
renew: true
})
$intents.finish('Oook!,1234');
``
例如选中如下文字:
True argumentation is the most important kind of communication in the academic and professional world. Used effectively, it is how ideas are debated and shared in discourse communities. Argumentation holds both writers and readers to the highest standards of responsibility and ethics. It is usually not what you see on cable news shows or, sadly, even in presidential debates. This section will show how rhetoric is used in service of argumentation.
$keyboard.selectedText 的值却是 True argumentation is the most important kind of communication in the academic and professional world. This section will show how rhetoric is used in service of argumentation.
不确定触发 Bug 的原因是什么,在中英文情况下都会存在,也许是标点符号,因为缺少的选中内容刚好在句点之间。
Could you add a license (like MIT or GPL) to this project so that people can reuse the code in the examples?
建议在 zhidao-daily 内添加 $app.open()
强制在 app 内打开以提升体验。
IOS 应该是有开放短信权限的吧,不然那些短信拦截程序也不能实现。
我觉得这个应该是个很有意思的功能。
可以实现按照规则自动转发短信之类的功能。
如果有了这个功能,我就可以给自己开发一个脚本:
①在调试代码时,如果脚本出现错误,就会出现一个错误的bug虫标志,当修改代码之后,那bug虫依然还在,必须保存之后退出再进入才可以。这样太耽误时间了。
1.是不是可以加入多个按钮调试(比如"运行按钮","bug按钮")
2.或者出现错误之后修改完,立刻出现运行按钮来测试
②在商店里面不能进入代码,只有官网,也要返回到xteko区。
反馈来之制作者长期制作时出现阻挡制作效率的痛苦
此疑问来自 xTeko 插件商店的插件 xTeko 收藏夹
和 #4
根据 xTeko 文档 应用 - xTeko,判断扩展是否运行在通知中心的方法是:
if ($app.env == $env.today) {
}
但在运行时会报错 ReferenceError: Can't find variable: $env
根据 常量 - xTeko 中的方法指定 $env
后可以正常运行:
+ var $env = {
+ app: 1 << 0,
+ today: 1 << 1,
+ ...
+ }
if ($app.env == $env.today) {
}
条件所限,目前仅测试过在 iPhone 6s 的 10.3.3, 10.3.2, 10.0.2 上 100% 复现此问题,不知是否为个例?
function sleep(numberMillis) {
var now = new Date();
var exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
return;
}
}
$ui.render({
type: "view",
props: {
title: "加解密"
},
views: [{
type: "tab",
props: {
id: "tab",
items:["加密","解密"],
index: 1
},
layout: function(make, view) {
make.top.equalTo(0).offset(10)
},events: {
changed: function(sender) {
var items = sender.items
var index = sender.index
sleep(3000)
$ui.toast(index + ": " + items[index])
}
}
}]
})
如题。如果AnyKey不能支持中文的输入的话,需要频繁地来回切换,实用性大打折扣了。
我看了开发文档,没有找到进行模拟操作的api,比如说某应用控件的点击输入等。
只找到了一个$app.openURL("weixin://")的接口,我没有太理解这个URL的作用,这个URL是和控件关联的吗?
我想知道能不能写出完成自动进行回复消息等之类的脚本。谢谢。
Hello Developer,
I find a simple type definition for JSBox at here, but its out of date.
Does the product (JSBox) have a plan to publish the official type definition file ?
Thanks
如题
$http.get({
url: "http://tool.manmanbuy.com/m/history.aspx?DA=1&action=gethistory&token=9dnaf375809e349db93c3db4d77dc3cc4b7aiq&url=http://v.cvz5.com/h.uD3Aww",
handler: function (resp) {
$console.info(resp.data)
$console.info(resp.error)
$ui.alert({
title: "Response",
message: resp.data
})
}
})
resp 的 data 是 null,但是通过 Charles 抓包发现有返回数据的
{
"ok": 1,
"cusitename": "淘宝天猫",
"jsData": "[Date.UTC(2016,9,20),3699],[Date.UTC(2017,5,1),3698],[Date.UTC(2017,5,4),3699],[Date.UTC(2017,5,18),3698],[Date.UTC(2017,6,2),3699],[Date.UTC(2017,7,3),3689],[Date.UTC(2017,7,9),3699]",
"zdprice": 3689,
"zdtime": "2017/8/3",
"spname": "Sony/索尼 MDR-Z7 头戴式高端耳机 顺丰包邮",
"spurl": "https://detail.tmall.com/item.htm?id=41298378165",
"flurl": "http://tool.manmanbuy.com/redirectTaobao.aspx?num=41298378165&url=https://detail.tmall.com/item.htm?id=41298378165",
"spzhoushi": "<span class='history-trend'><i class='t-3'></i>价格上涨</span>",
"sppic": "http://img.alicdn.com/imgextra/i1/TB1qCbnNXXXXXavXVXXXXXXXXXX_!!0-item_pic.jpg_400x400.jpg",
"spprice": 3699
}
怎么将jsbox集成到我的iOS工程项目中呢?
请问如何实现取消单次延迟执行的定时器?类似的 js 代码:
const foo = setTimeout(()=>{}, 1000);
clearTimeout(foo);
文档 https://docs.xteko.com/#/foundation/thread 写了4种延迟执行的方法
$thread.background(object)
$thread.main(object)
$delay(number, function)
$timer.schedule(object)
只有 $timer.schedule() 可以被取消,没有取消一次性延迟任务的方法。
目前$define只能够新增objc class,似乎也可以给现有class添加新方法。但是如果想要替换class中原有方法就会触发异常。是否可以增加更多objc class的操作。另外,似乎没有办法访问到没有访问器的成员变量,只能通过访问器访问属性,是否可以增加访问成员变量的功能。
参见JSPatch,JSPatch实现了大量objc的操作,包括动态替换、动态增加现有类的方法、动态增加协议、动态访问成员变量...
I use the VScode or read the phone Input Chinese character as parameters cannot be identified.
icon_063.png
这样真的很不方便。
当使用Proxy来拦截一个对象的$someFunc方法时,出现错误 "proxy.__invoke is not a function"。实际上,可以发现当调用proxy.$someFunc时,实际调用的是proxy.__invoke("someFunc");
例如:以下这段代码,在jsbox1.27.0运行报错,但是在Chrome68却能正常运行。
var a = {
$render: () => {
return 1;
}
}
console.log(a.$render()) // 1
var ap = new Proxy(a, {
get(target, property) {
console.log("property name is: " + property);
if (property === "$render")
return function () {
return 2
}
}
})
console.log(ap.$render); //property name is $render & shows the function body normally
console.log(ap.$render()); //property name is __invoke & throw an error
如果把函数名去掉开头的$则可以正常运行。
text控件是嵌套在list中的,上个issues中的代码就能复现
😂或者整个插件的文件系统都放在icloud drive,这样写插件改插件就更简单,不用直接在手机改了
workflow现在就支持向icloud drive存储数据
使用了一个list来内嵌TEXT组件用以输入内容,当text过多,编辑最后一个text的内容时,键盘会把text组件遮挡,包括原生键盘
这是复现代码,在最新的tf版本中能够复现
$ui.render({
layout: $layout.fill,
views: [{
type: "button",
props: {
title: "生成配置"
},
layout: function (make) {
make.left.right.bottom.inset(10)
make.height.equalTo(32)
},
events: {
tapped: function (sender) {
//selectItem()
}
}
}, {
type: "list",
layout: function (make) {
make.left.top.right.equalTo(0)
make.bottom.equalTo($("button").top).offset(0)
},
props: {
rowHeight: 150,
data: ['1','2','3','4','5','6','7','8','9','10'].map(function (cus) {
let cfg = cus;
if(typeof cus === 'string'){
cfg = {
name:cus
}
}
return {
title: `${cfg.name} ${cfg.text?`(${cfg.text})`:''}`,
rows: [{
type: "text",
props: {
id: cfg.name,
text: '',
},
layout: function (make) {
make.edges.inset(5);
}
}]
}
})
}
}]
})
请教一下,在使用 OpenAI 的 API 进行提问回答时,若采用其 stream 的方式对回答内容进行输出,那么在 JSBox 上的 $http.request()
的handler
该怎么写呢?
Could you add a license (like MIT or GPL) to this project so that people can reuse the code in the examples?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.