stampit-org / stampit

OOP is better with stamps: Composable object factories.
https://stampit.js.org
MIT License
3.02k stars 102 forks source link

Please help,I would like update V2 to V4 #355

Closed minjiewang29 closed 2 years ago

minjiewang29 commented 2 years ago

`"use strict"

var stampit = require('stampit')

module.exports = stampit() .init(function () { this.state = this.state || {} }) .static({ handlers (newHandlers) { this.fixed.refs._handlers = this.fixed.refs._handlers || {} Object.assign(this.fixed.refs._handlers, newHandlers) return this } }) .methods({ digest (action, ...data) { if (this._handlers[action]) { this._handlers[action].call(this, this.state, ...data) } }, addDispatcher (dispatcher) { this.dispatcher = dispatcher this.dispatch = this.dispatcher.dispatch.bind(this.dispatcher) } }) `

koresar commented 2 years ago

Thanks for doing it by yourself mate.

For others, the way to upgrade can be found by link in README. See Status: https://github.com/stampit-org/stampit#status