【文件属性】:
文件名称:ember-lifecycle-utils:Ember 中与生命周期相关的东西的实用程序
文件大小:212KB
文件格式:ZIP
更新时间:2021-07-24 01:07:53
JavaScript
余烬生命周期工具
使用生命周期时减少样板的实用程序
安装
ember install ember-lifecycle-utils
用法
香草类和可破坏物
import { withCleanup } from 'ember-lifecycle-utils' ;
class Hello {
constructor ( ) {
withCleanup ( this , ( ) => {
window . addEventListener ( 'click' , this . handleClick ) ;
return ( ) => {
window . removeEventListener ( 'click' , this . handleClick ) ;
}
} ) ;
}
}
这可用于帮助制作更简洁的
【文件预览】:
ember-lifecycle-utils-main
----.prettierignore(253B)
----.gitignore(383B)
----tsconfig.json(1KB)
----README.md(2KB)
----CHANGELOG.md(1KB)
----ember-cli-build.js(566B)
----.github()
--------workflows()
--------renovate.json5(2KB)
----.ember-cli(280B)
----tests()
--------integration()
--------test-helper.js(324B)
--------dummy()
--------unit()
--------helpers()
--------index.html(1KB)
----testem.js(589B)
----app()
--------.gitkeep(0B)
----package.json(4KB)
----CONTRIBUTING.md(616B)
----vendor()
--------.gitkeep(0B)
----index.js(72B)
----config()
--------ember-try.js(981B)
--------environment.js(90B)
----LICENSE.md(1KB)
----addon()
--------modifier.ts(69B)
---------private()
--------index.ts(416B)
----.watchmanconfig(37B)
----types()
--------dummy()
--------global.d.ts(205B)
----.eslintignore(253B)
----.template-lintrc.js(63B)
----.npmignore(458B)
----.travis.yml(2KB)
----.editorconfig(367B)
----yarn.lock(567KB)
----.eslintrc.js(112B)
----.prettierrc.js(58B)