Files
homeos_ws/src/hos_cosgi_testwebapp/webroot/libs/hos/RuleEngine.js
T
2015-06-12 09:05:18 +02:00

38 lines
959 B
JavaScript

define([
"dojo/_base/config",
'dojo/_base/declare',
'dojo/_base/lang',
'dstore/Store',
'dojo/request',
'dstore/QueryResults',
'dstore/Cache',
"hos/Socket",
"dojo/request/xhr",
"dojox/uuid/generateRandomUuid"
], function(config, declare, lang, Store, request, QueryResults, Cache, Socket, xhr, generateRandomUuid){
var _RuleEngineStore = declare([Store], {
_request: function (target, options) {
// Most responses will be in JSON, so we make that the default expected format.
options = lang.mixin({ handleAs: 'json' }, options);
options.headers = lang.mixin({}, this.headers, options.headers);
return request(this.target + target, options);
},
fetch: function () {
return new QueryResults(this._request('packages'));
}
});
var RuleEngineStore = declare([_RuleEngineStore, Cache], {
isValidFetchCache: true
});
var _store = new RuleEngineStore({
target: config.hos.ruleEngineUrl
});
return _store;
});