脚本宝典收集整理的这篇文章主要介绍了野狗与微信小程序的结合,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
wilddog-weapp
注意:
由于微信没有正式公开小程序,所以此版本为预览版,请不要用于正式生产环境
已知问题:
项目地址
https://github.com/WildDogTea...
引入野狗客户端
将wilddog-weapp-all.js 直接放到微信小程序的项目中
使用commonjs引入
VAR wilddog = require('wilddog-weapp-all')
初始化
var config = {
syncURL:<your-app-url>
}
wilddog.initializeApp(config)
使用 on
,once
,set
,push
,update
等API进行数据同步操作。
比如:
var ref = wilddog.sync().ref('demo')
ref.on('child_changed',(snapshot) => {
var value = snapshot.val()
console.log(value)
})
ref.on('child_changed',(snapshot) => {
//you code
})
ref.orderByPriority().limitToFirst(100).once('value',(snapshot)=>{
var key = snapshot.key()
var value = snapshot.val()
})
ref.child('abc').set(123)
ref.child('abc').push('hello world',function(err){
if(err){
//sync to cloud with error
}
else{
//OK!
}
})
具体参考 https://docs.wilddog.com/api/...
支持 Wilddog.sync 下所有的API
DEMO
目前只写了一个粗糙的demo
https://github.com/stackOverM...
contribute
非常欢迎各种形式的issue,和代码。
以上是脚本宝典为你收集整理的野狗与微信小程序的结合全部内容,希望文章能够帮你解决野狗与微信小程序的结合所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。