業界トップクラスの求人数を誇る転職エージェントPR

リクルートグループのコネクションを活かした非公開求人も充実、他にはない好条件の求人と出会える

2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GASで無名関数を実行する

Posted at

GoogleAppsScriptをCoffeeScriptで書くときのバッドノウハウ

実行する関数を選びたい。

空のスクリプト作って・・・

無題のプロジェクト.png

CoffeeScript書いて・・・

hoge.coffee
@func1 = () ->
  Logger.log "func1 called!"

@func2 = () ->
  Logger.log "func2 called!"

コンパイルして貼っつける。

無題のプロジェクト.png

myFunctionしか選べない・・・。

無題のプロジェクト.png

実行関数を強引に選ぶ

ダミーの関数を作ってしまえば選べるようになる。

function func1(){};
function func2(){};

無題のプロジェクト.png

ダミー関数消しても使える。

無題のプロジェクト.png

実行も出来る。

なぜかは不明・・・。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?