LoginSignup
1
1

More than 5 years have passed since last update.

Widget先やRequire先のUIにstyleやeventを簡単に適用する方法

Posted at

これだけだとtssの内容やonClickイベントがhogeに適用されない

index.xml
<Require id="button" src="button" onClick="click" />
index.tss
"#button": {
    title: L('button')
}
button.xml
<Button id="hoge"></Button>

なので、button.coffeeに以下を追加するとそれっぽく適用される

button.coffee(button.js)
args = arguments[0] or {}

delete args.id
delete args.__parentSymbol
$.hoge.applyProperties args

exports.on = $.hoge.addEventListener
exports.off = $.hoge.removeEventListener
exports.trigger = $.hoge.fireEvent
1
1
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
1
1