[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:
Victor Woeltjen
2014-11-20 12:58:21 -08:00
parent c50ca2e92b
commit 0fdce798f7
38 changed files with 2914 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
/*global define,Promise*/
/**
* Module defining ActionCapability. Created by vwoeltje on 11/10/14.
*/
define(
[],
function () {
"use strict";
/**
*
* @constructor
*/
function ActionCapability(actionService, domainObject) {
var self;
function getActions(context) {
var baseContext = typeof context === 'string' ?
{ key: context } :
(context || {}),
actionContext = Object.create(baseContext);
actionContext.domainObject = domainObject;
return actionService.getActions(actionContext);
}
function performAction(context) {
var actions = getActions(context);
return Promise.resolve(
(actions && actions.length > 0) ?
actions[0].perform() :
undefined
);
}
self = {
invoke: function () {
return self;
},
perform: performAction,
getActions: getActions
};
return self;
}
return ActionCapability;
}
);