2
2

More than 5 years have passed since last update.

TiShadow spec でAlloy.Globalsがundefinedになるとき

Last updated at Posted at 2014-05-20

遭遇した問題

Titamium Mobile + Alloyを使って
TiShadow spec しているときに、alloy.jsで定義したAlloy.Globalsがundefinedになる。

console.log(Alloy.Glibals)は空のオブジェクト「{}」となっている。

仮説

Alloyがprecompileしたalloy.jsをtishadiw specで読み取れていないのではないか?

やったこと

「Alloy.Globals」をbuild/以下でgrepしたところ、build/tishadow/src/android/app.js に、自分が定義したと思しきコードを発見した。
そこで

describe("xxxx", function(){
    var Alloy = require("alloy");
    var App = require("app");
    :
    :
});

のように書いたところ、undefinedが解消できた。

precompile後のapp.jsはcontroller/index をcreateController()するのが残念。これは、今は影響がなかったので対応を保留した。

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
2
2