vojtech-dobes/nette-signals-trait
Composer 安装命令:
composer require vojtech-dobes/nette-signals-trait
包简介
Learn any of your Nette components to understand signals!
关键字:
README 文档
README
Learn any of your components to understand signals!
License
New BSD
Dependencies
- PHP 5.4
- Nette 2.0.0
Installation
Get the source code from Github or via Composer (vojtech-dobes/nette-signals-trait).
Usage
1.. Make your component (implementation of Nette\ComponentModel\IComponent) implement Nette\Application\UI\ISignalReceiver interface.
class AutocompleteField extends Nette\Forms\Controls\TextInput implements Nette\Application\UI\ISignalReceiver
2.. Use Nextras\Signals\Receiver trait in your component .
use Nextras\Signals\Receiver;
3.. Register signals:
public function __construct() { $this->__signals()->addSignal('autocomplete', function (Nette\Application\UI\Presenter $presenter, $phrase) { $presenter->sendJson( ... ); }); }
Now the component supports signal autocomplete, in same way as handleAutocomplete() method would work in your component inheriting Nette\Application\UI\Control.
You will probably also need to create link to it:
$this->__signals()->createLink('autocomplete', 'testPhrase');
统计信息
- 总下载量: 2.5k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: New
- 更新时间: 2014-02-10