MCPcopy Create free account
hub / github.com/mgonto/restangular / addRestangularMethodFunction

Function addRestangularMethodFunction

src/restangular.js:1359–1387  ·  view source on GitHub ↗
(name, operation, path, defaultParams, defaultHeaders, defaultElem)

Source from the content-addressed store, hash-verified

1357 }
1358
1359 function addRestangularMethodFunction(name, operation, path, defaultParams, defaultHeaders, defaultElem) {
1360 var bindedFunction;
1361 if (operation === 'getList') {
1362 bindedFunction = _.bind(fetchFunction, this, path);
1363 } else {
1364 bindedFunction = _.bind(customFunction, this, operation, path);
1365 }
1366
1367 var createdFunction = function(params, headers, elem) {
1368 var callParams = _.defaults({
1369 params: params,
1370 headers: headers,
1371 elem: elem
1372 }, {
1373 params: defaultParams,
1374 headers: defaultHeaders,
1375 elem: defaultElem
1376 });
1377 return bindedFunction(callParams.params, callParams.headers, callParams.elem);
1378 };
1379
1380 if (config.isSafe(operation)) {
1381 this[name] = createdFunction;
1382 } else {
1383 this[name] = function(elem, params, headers) {
1384 return createdFunction(params, headers, elem);
1385 };
1386 }
1387 }
1388
1389 function withConfigurationFunction(configurer) {
1390 var newConfig = angular.copy(_.omit(config, 'configuration'));

Callers

nothing calls this directly

Calls 1

createdFunctionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…