現在、 javascript windows (8) ストア アプリケーション内で使用する ember.js を評価しています。アプリケーション自体は、それほど興味深いものではありません。私たちが直面している問題は、DOM に挿入される動的コンテンツを操作するときに適用される制限に関連しています。Windows ストア アプリは、"ローカル" コンテキストで実行されます。つまり、Windows ストア アプリケーションが通常どのように構築されるかです。ローカル コンテキストでは、Windows ストア アプリケーションの html「ブラウザ ホスト」はかなり制限されたモードで動作します。たとえば、Microsoft が提供する「プロキシ」関数 ( MSApp.execUnsafeLocalFunction ) によって明示的にカプセル化されていない場合、innerHTML、outerHTML の設定、またはスクリプト要素を保持するコンテンツの追加はすべてブロックされます。
例: Ember.View appendTo はそのままでは機能しません。これを機能させるには、関数で appendTo への jQuery 呼び出しを MSApp.execUnsafeLocalFunction プロキシ関数でカプセル化する必要があります。
オリジナル: (Ember.Viewで)
appendTo: function(target) {
// Schedule the DOM element to be created and appended to the given
// element after bindings have synchronized.
this._insertElementLater(function() {
Ember.assert("You cannot append to an existing Ember.View. Consider using Ember.ContainerView instead.", !Ember.$(target).is('.ember-view') && !Ember.$(target).parents().is ('.ember-view'));
this.$().appendTo(target);
});
return this;
},
Windows ストア アプリで動作するように変更
appendTo: function(target) {
// Schedule the DOM element to be created and appended to the given
// element after bindings have synchronized.
this._insertElementLater(function() {
Ember.assert("You cannot append to an existing Ember.View. Consider using Ember.ContainerView instead.", !Ember.$(target).is('.ember-view') && !Ember.$(target).parents().is ('.ember-view'));
var self = this;
MSApp.execUnsafeLocalFunction(function () {
self.$().appendTo(target);
});
});
return this;
},
Windows ストア アプリをサポートする計画はありますか、または ember コード全体にパッチを適用せずにこの問題を解決する方法についてアドバイスはありますか? 本当にいろいろ調べたのですが、javascriptのWindowsストアアプリでember.jsを動作させようとしている人は少ないようです。ハイブリッド/クロス プラットフォームの JavaScript アプリケーションを構築するための "コア" JavaScript フレームワークとして使用したいと思っています。
使用したライブラリ
- ember-1.0.0-rc.3
- ハンドルバー-1.0.0-rc.3
- jquery-2.0.0 (Windows 8 アプリの準備ができていると仮定)
- jquery-ui-1.10.3
Microsoft は、上記の制限についてここで説明しています。
返信やアイデアをありがとうございます...どんな助けもいただければ幸いです!
注: ember ディスカッション フォーラムに投稿:こちら