Picture Credit: https://www.shareicon.net
Abstract(Base) Class of Puppet Providers for Wechaty Framework.
This module is part of the Wechaty SDK.
Learn more at:
Wechaty Puppet Provider Interface Documentation can be found at https://chatie.io/wechaty-puppet/typedoc/classes/puppet.html
Automatica Generated by TypeDoc
PuppetMock: https://github.com/chatie/wechaty-puppet-mock
The above puppet provider is just for mocking and easy to understand. It will be a good starter when you want to develope a new puppet by yourself for fullfil your need, for example, connect Wechaty with Wechat Official Account.
- PuppetPadchat iPad API via Protocol Server, created by @lijiarui
- PuppetIoscat iPhone App Hook API, created by @linyimin-bupt
- PuppetWechat4u Web API via HTTP, created by @zixia
- PuppetPuppeteer Web API via Browser, created by @zixia
- PuppetHostie gRPC Proxy via Chatie.io(PaaS - Puppets as a Service), created by @zixia
FileBox
(npm modulefile-box
) must be a peerDependencies because all the Wechaty Framework needs to checkinstanceof FileBox
, we must be sure allFileBox
is the same version.MemoryCard
(npm modulememory-card
) must be a peerDependencies because all the Wechaty Framework needs to checkinstanceof MemoryCard
, we must be sure allMemoryCard
is the same version.Puppet
(npm modulewechaty-puppet
) itself must be a peer Dependencies for all the Puppet Providers, and should only be installed via Wechaty because all Puppet Providers should share the same Puppet Base Class with Wechaty, we must be sure allPuppet
is the same version.
You can get to know the puppet start/stop state from the state
property:
puppet.state.on() === 'pending'
will be true when the puppet is startingpuppet.state.on() === true
will be true when the puppet is startedpuppet.state.off() === 'pending'
will be true when the puppet is stoping- `puppet.state.off() === true' will be true when the puppet is stopped
Learn more about the puppet.state at https://github.com/zixia/state-switch
Using Brolog to output necessary log messages.
import { log } from 'brolog'
log.verbose('ModuleName', 'methodName() Your Verbose Message Here')
log.silly('ModuleName', 'methodName() Your Silly Message Here')
Brolog has five log levels, it should be used and follow the following rules:
Log Level | What does it means | Usage in Puppet |
---|---|---|
log.silly() |
There's some detail debug information | Can be used in everywhere as you like |
log.verbose() |
There's some debug information | Should be used at the beginning of every method() |
log.info() |
||
log.warn() |
There's a Coverable Error | Should not be used unless we have to |
log.error() |
There's a Un-covered Error | Should not be used unless we have to |
- Functional Programming Concepts: Pure Functions
- What Are Pure Functions And Why Use Them?
- Master the JavaScript Interview: What is a Pure Function?
- Code & Docs © 2018 Huan LI <[email protected]>
- Code released under the Apache-2.0 License
- Docs released under Creative Commons