Skip to content

Commit

Permalink
update clone-class@1.1.1 (huan/clone-class#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
huan committed Nov 22, 2021
1 parent 84c77f8 commit 1ec8c40
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 55 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
},
"homepage": "https://github.com/wechaty/",
"dependencies": {
"clone-class": "~1.0.3",
"clone-class": "~1.1.1",
"cockatiel": "^2.0.2",
"dotenv": "^10.0.0",
"fp-ts": "^2.11.5",
Expand Down
24 changes: 0 additions & 24 deletions src/deprecated/clone-class.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/user-modules/contact-self.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import type {
FileBoxInterface,
} from 'file-box'

import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'

import {
guardQrCodeValue,
Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import type {

import type {
Constructor,
} from '../deprecated/clone-class.js'
} from 'clone-class'

import {
log,
Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/delay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*
*/
import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'
import { validationMixin } from '../user-mixins/validation.js'

import {
Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/favorite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/
import { log } from 'wechaty-puppet'
import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'
import { validationMixin } from '../user-mixins/validation.js'

import {
Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/friendship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
import { EventEmitter } from 'events'
import * as PUPPET from 'wechaty-puppet'
import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'

import {
retryPolicy,
Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import * as PUPPET from 'wechaty-puppet'
import type {
FileBoxInterface,
} from 'file-box'
import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'
import { validationMixin } from '../user-mixins/validation.js'
import { log } from '../config.js'

Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/
import type * as PUPPET from 'wechaty-puppet'
import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'
import { log } from '../config.js'

import { validationMixin } from '../user-mixins/validation.js'
Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type {
FileBoxInterface,
} from 'file-box'

import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'

import { escapeRegExp } from '../pure-functions/escape-regexp.js'
import { timestampToDate } from '../pure-functions/timestamp-to-date.js'
Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/mini-program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
import type * as PUPPET from 'wechaty-puppet'

import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'
import { log } from '../config.js'

import { validationMixin } from '../user-mixins/validation.js'
Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/moment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/
import { log } from 'wechaty-puppet'
import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'

import type { ContactInterface } from './contact.js'
import { validationMixin } from '../user-mixins/validation.js'
Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/money.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
*
*/
import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'
import { validationMixin } from '../user-mixins/validation.js'

import {
Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/room-invitation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import type * as PUPPET from 'wechaty-puppet'

import { log } from '../config.js'
import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'

import type {
Accepter,
Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type { FileBoxInterface } from 'file-box'

import type {
Constructor,
} from '../deprecated/clone-class.js'
} from 'clone-class'

import {
FOUR_PER_EM_SPACE,
Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
log,
} from 'wechaty-puppet'

import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'

import { ContactInterface, ContactImpl } from './contact.js'
import { FavoriteInterface, FavoriteImpl } from './favorite.js'
Expand Down
2 changes: 1 addition & 1 deletion src/user-modules/url-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import Url from 'url'

import type * as PUPPET from 'wechaty-puppet'
import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'

import {
openGraph,
Expand Down
26 changes: 12 additions & 14 deletions src/wechaty/wechaty-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,24 @@ class WechatyBase extends mixinBase implements SayableSayer {
static override readonly VERSION = VERSION
readonly wechaty : WechatyInterface

readonly _cleanCallbackList: (() => void)[] = []
readonly _stopCallbackList: (() => void)[] = []

/**
* The term [Puppet](https://github.com/wechaty/wechaty/wiki/Puppet) in Wechaty is an Abstract Class for implementing protocol plugins.
* The term [Puppet](https://wechaty.js.org/docs/specs/puppet) in Wechaty is an Abstract Class for implementing protocol plugins.
* The plugins are the component that helps Wechaty to control the WeChat(that's the reason we call it puppet).
* The plugins are named XXXPuppet, for example:
* - [PuppetPuppeteer](https://github.com/wechaty/wechaty-puppet-puppeteer):
* - [PuppetPadchat](https://github.com/wechaty/wechaty-puppet-padchat)
* - [PuppetWeChat](https://github.com/wechaty/puppet-wechat):
* - [PuppetWeChat](https://github.com/wechaty/puppet-service):
* - [PuppetXP](https://github.com/wechaty/puppet-xp)
*
* @typedef PuppetModuleName
* @property {string} PUPPET_DEFAULT
* The default puppet.
* @property {string} wechaty-puppet-wechat4u
* The default puppet, using the [wechat4u](https://github.com/nodeWechat/wechat4u) to control the [WeChat Web API](https://wx.qq.com/) via a chrome browser.
* @property {string} wechaty-puppet-padchat
* - Using the WebSocket protocol to connect with a Protocol Server for controlling the iPad WeChat program.
* @property {string} wechaty-puppet-puppeteer
* @property {string} wechaty-puppet-service
* - Using the gRPC protocol to connect with a Protocol Server for controlling the any protocol of any IM program.
* @property {string} wechaty-puppet-wechat
* - Using the [google puppeteer](https://github.com/GoogleChrome/puppeteer) to control the [WeChat Web API](https://wx.qq.com/) via a chrome browser.
* @property {string} wechaty-puppet-mock
* - Using the mock data to mock wechat operation, just for test.
Expand Down Expand Up @@ -160,10 +161,7 @@ class WechatyBase extends mixinBase implements SayableSayer {
log.verbose('Wechaty', 'constructor()')

this.__memory = this.__options.memory

this._cleanCallbackList = []

this.wechaty = this
this.wechaty = this
}

override async onStart (): Promise<void> {
Expand All @@ -179,7 +177,7 @@ class WechatyBase extends mixinBase implements SayableSayer {
const lifeTimer = setInterval(() => {
log.silly('Wechaty', 'onStart() setInterval() this timer is to keep Wechaty running...')
}, 1000 * 60 * 60)
this._cleanCallbackList.push(() => clearInterval(lifeTimer))
this._stopCallbackList.push(() => clearInterval(lifeTimer))

this.emit('start')
log.verbose('Wechaty', 'onStart() ... done')
Expand All @@ -194,8 +192,8 @@ class WechatyBase extends mixinBase implements SayableSayer {
)

// put to the end of the event loop in case of it need to be executed while stopping
this._cleanCallbackList.map(setImmediate)
this._cleanCallbackList.length = 0
this._stopCallbackList.map(setImmediate)
this._stopCallbackList.length = 0

this.emit('stop')
log.verbose('Wechaty', 'onStop() ... done')
Expand Down
2 changes: 1 addition & 1 deletion src/wechaty/wechaty-impl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { EventEmitter } from 'events'
import type TypedEventEmitter from 'typed-emitter'

import type { Constructor } from '../deprecated/clone-class.js'
import type { Constructor } from 'clone-class'
import type {
WechatyMixinProtectedProperty,
} from '../wechaty-mixins/mod.js'
Expand Down

0 comments on commit 1ec8c40

Please sign in to comment.