Package Exports
- clone-class
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (clone-class) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
CLONE CLASS
Clone an ES6 Class as Another Class Name for Isolating Static Properties in the Classes.
EXAMPLE
Shell
$ npm i clone-classTypeScript
import cloneClass from '../'
class Employee {
public static company: string
constructor(
public name: string,
) {
}
public info() {
console.log(`Employee ${this.name}, Company ${(this.constructor as any).company}`)
}
}
const GoogleEmployee = cloneClass(Employee)
GoogleEmployee.company = 'Google'
const MicrosoftEmployee = cloneClass(Employee)
MicrosoftEmployee.company = 'Microsoft'
const employee1 = new GoogleEmployee('Tom')
const employee2 = new MicrosoftEmployee('Jerry')
employee1.info()
// Output: Employee Tom, Company Google
employee2.info()
// Output: Employee Jerry, Company MicrosoftCHANGELOG
v0.2.0 (Apr 2018)
First publish version.
v0.0.1 (Apr 23, 2018)
Initial version, seprecated from Project Wechaty.
AUTHOR
COPYRIGHT & LICENSE
- Code & Docs © 2016-2018 Huan LI <zixia@zixia.net>
- Code released under the Apache-2.0 License
- Docs released under Creative Commons