How can I access the variable inventory outside the callback? I would like to access it and return it.
loadInventory = function () {
var inventory = [];
offers.loadMyInventory({
appId: 730,
contextId: 2,
tradableOnly: true
}, function (err, items) {
items.forEach(function (item) {
inventory.push({
asset_id: item.id,
market_name: item.market_name
});
});
//Not accessible here
});
};