我正在爲我的移動應用程序項目使用IBM worklight 6.1和backbone.js。我的問題是,如何將工作燈適配器與骨幹視圖集成?IBM Worklight 6.1 - 如何將工作燈適配器與主幹視圖集成?
工作燈適配器
Username.xml
<wl:adapter name="Username"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wl="http://www.worklight.com/integration"
xmlns:http="http://www.worklight.com/integration/http">
<displayName>Username</displayName>
<description>Username</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>example.com</domain>
<port>9081</port>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="getUsername"> </procedure>
</wl:adapter>
用戶名,impl.js
function getUsername(userAlias,locale) {
path = "rest-rib/service/Login/login_username?userAlias=" + userAlias + "&locale=" + locale;
var input = {
method : 'post',
returnedContentType : 'json',
path : path
};
return WL.Server.invokeHttp(input);
}
BackboneView
HomeView.js
define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.html'], function($, _, Backbone, homeViewTemplate) {
var HomeView = Backbone.View.extend({
initialize: function() {
this.$el.off();
},
render: function() {
this.$el.html(homeViewTemplate);
},
});
return HomeView;
});
非常感謝。