[Core] Bring in core bundle from sandbox
Bring in bundle platform/core from the sandbox branch, in preparation for clean up, tests, and integration. WTD-573
This commit is contained in:
36
platform/core/src/models/PersistedModelProvider.js
Normal file
36
platform/core/src/models/PersistedModelProvider.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/*global define,Promise*/
|
||||
|
||||
/**
|
||||
* Module defining PersistedModelProvider. Created by vwoeltje on 11/12/14.
|
||||
*/
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function PersistedModelProvider(persistenceService, $q, SPACE) {
|
||||
function promiseModels(ids) {
|
||||
return $q.all(ids.map(function (id) {
|
||||
return persistenceService.readObject(SPACE, id);
|
||||
})).then(function (models) {
|
||||
var result = {};
|
||||
ids.forEach(function (id, index) {
|
||||
result[id] = models[index];
|
||||
});
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
getModels: promiseModels
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
return PersistedModelProvider;
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user