# kintoneカスタマイズの記述方法について

**URL:** <https://community.cybozu.dev/t/topic/3913>\
**Category:** kintone 開発相談\
**Created:** [2019 年 4 月 6 日午前 12:57 UTC](https://community.cybozu.dev/t/topic/3913 "2019-04-06T00:57:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Legacy\_Account932](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Legacy\_Account932](https://community.cybozu.dev/u/Legacy_Account932)\
**Post date:** [2019 年 4 月 6 日午前 12:57 UTC](https://community.cybozu.dev/t/topic/3913/1 "2019-04-06T00:57:21Z")

</div>

javascriptファイルの書き方について質問です。

下記の用に１つのjsファイルに複数のイベントを記載するのは問題ないでしょうか？

それともイベントごとにファイルを分けたほうがいいのでしょうか？

ご教示いただけるとたすかります。

よろしくお願いいたします。

```
(function(){

'use strict'

  kintone.events.on(['app.record.create.show'], function(event) {

    returnevent;
  });

  kintone.events.on(["app.record.create.change.案件名","app.record.edit.change.案件名"], function(event) {

    returnevent;

  });

  kintone.events.on(["app.record.create.change.担当者","app.record.edit.change.担当者"], function(event) {
    returnevent;

  });

})();

```

&nbsp;

---

<div class="post-metadata">

**Author:** ![Legacy\_Account1574](https://avatars.discourse-cdn.com/v4/letter/l/76d3ee/32.png) [@Legacy\_Account1574](https://community.cybozu.dev/u/Legacy_Account1574)\
**Post date:** [2019 年 4 月 6 日午前 4:31 UTC](https://community.cybozu.dev/t/topic/3913/2 "2019-04-06T04:31:41Z")

</div>

この辺も趣味の領域かと思いますが、問題ないと思います。

&nbsp;

既にロジックとその発火ポイント（イベント）を分離してイベントを1ファイルに記述されてさらに分離するかですが、イベント部分が肥大化してきたらまた分離する、くらいで良いのではないかと思います。1つのアプリに沢山イベント定義することもありますが、分離しようと思ったことは個人的にはありません。また、肥大化しうる要因としては、現状だと変更系のイベントが動的ですがその他はそもそものイベント数も固定で感覚的には多くないかなぁと思っていますので、実際に作業しててイベントの定義の量が増えたり今後更にイベントが追加されて多いと感じた時にshow/submit/changeで分ける等考えると良いのではないでしょうか。

---

<div class="post-metadata">

**Author:** ![Legacy\_Account932](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Legacy\_Account932](https://community.cybozu.dev/u/Legacy_Account932)\
**Post date:** [2019 年 4 月 6 日午前 5:00 UTC](https://community.cybozu.dev/t/topic/3913/3 "2019-04-06T05:00:28Z")

</div>

[Ryu Yamashita](https://community.cybozu.dev/hc/ja/profiles/467695324-Ryu-Yamashita)さん

ご返信ありがとうございます！

勉強になりました！

参考にさせていただきます。
