https://github.com/zixiaowang/tns-wechat
A WeChat plugin for NativeScript Project.
https://github.com/zixiaowang/tns-wechat
android javascript nativescript nativescript-plugin node-module
Last synced: 2 months ago
JSON representation
A WeChat plugin for NativeScript Project.
- Host: GitHub
- URL: https://github.com/zixiaowang/tns-wechat
- Owner: ZixiaoWang
- License: mit
- Created: 2017-06-15T16:17:50.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-27T04:35:06.000Z (almost 8 years ago)
- Last Synced: 2025-01-10T05:36:05.475Z (4 months ago)
- Topics: android, javascript, nativescript, nativescript-plugin, node-module
- Language: JavaScript
- Size: 10.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tns-wechat
A WeChat plugin for NativeScript Project.
Currently this plugin only suport Android platform, iOS is on its way coming.### I wanna share my stuff to WeChat
For Android developer, Please make sure you've gotten the **AppID** from Tecent.
Otherwise it will FAIL sharing any stuff to WeChat platform.### How Can I install this plugin?
At currently stage, the plugin still need some polishing work before being published. So if you wanna have a trial, or help me find any bugs or inappropriated places, you may install it via entering cammand
``` tns plugin add https://github.com/ZixiaoWang/tns-wechat.git```### How Can I use this plugin?
**Quick example**
```javascript
import * as WeChat from ('tns-wechat');function MyClass(){
// Register your appID
// 注册你的appID
let wechat = new WeChat('wx1234567890123456');
// Share Webpage to Timeline
// 分享网页到我的朋友圈
.sendWebpage('https://www.google.com')
.addTitle('Google')
.addDescription('This is description')
.addThumbnail('data:image/png;base64,AIND923kdf....')
.toTimeline();
}
```### APIs
#### isInstalled
```
isInstalled(): boolean
```
#### Send
```
sendText(txt: string): WeChat
sendWebpage(url: string): WeChat
sendImage(path: string): WeChat
sendImage(base64String: string): WeChat
```
#### Add
```
addTitle(title?: string): WeChat
addDescription(description: string): WeChat
addMessageTagName(msgTagName: string): WeChat
addMessageAction(msgAction: string): WeChat
addMessageExt(msgExt: string): WeChat
addThumbnail(localPath: string): WeChat
addThumbnail(base64String: string): WeChat
addThumbnail(image: ImageSource): WeChatdecorate({
title?: string,
description?: string,
messageTagName?: string,
messageAction?: string,
messageExt?: string,
thumbData?: string or ImageSource (imagePath or Base64String)
```
#### To
```
to(target: string): boolean (target must be in ["session", "timeline", "favorite"])
toSession(): boolean
toTimeline(): boolean
toFavorite(): boolean
```