question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make TradeOffer class exportable

See original GitHub issue

I’ve recently stumbled upon the Bluebird library and its’ Promise.promisifyAll method.

It would be cool to have the ability to run

Promise.promisifyAll(require('path-to-trade-offer-manager-class.js'))
Promise.promisifyAll(require('path-to-trade-offer-class.js'))

(or something like that, I didn’t try it yet)

I know I can require('steam-tradeoffer-manager/lib/index.js') to get the TradeOfferManager class, but if I’ll do require('steam-tradeoffer-manager/lib/classes/TradeOffer.js'), it will return an empty object, since this file doesn’t export anything.

So it would be nice to make lib/classes/TradeOffer.js export the TradeOffer function, so I can require just this class and do stuff with it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:23 (13 by maintainers)

github_iconTop GitHub Comments

7reactions
Aareksiocommented, May 17, 2017

@autaut03 We’re happy you want to become a part of this open source project and already came with the list of things that are bad/broken in the library. Can’t wait to see more of your contributions. Please make sure you follow the contribution guide while submiting your PR. Here’s a nodejs maintenance chart that may be useful to check which node versions are not depreciated, thus should be supported, please keep them in mind.

I see you have a problem with adding items to trade, filtered by other things than assetid, here is a little snippet you may be interested to use:

const selectedItems = items.filter(item => item.market_name === 'My Item Name');
offer.addItems(selectedItems);

Also, I’ll just leave this, this and perhaps this here for you.

4reactions
DoctorMcKaycommented, May 16, 2017

@autaut03:

  1. I’m incredibly sorry that Steam is slow for you. I would fix that, but last I checked, I don’t work for Valve.
  2. Umm, yes? That’s how node’s EventEmitter works.
  3. Promises aren’t everything. Node itself doesn’t use promises in its core library, which is why I haven’t prioritized using them here. I don’t use ES6 here because I want to support node v4 (which you say is unnecessary, but it is an LTS version). That’s a breaking change anyway. I’ll add it in the next major version, but I can’t guarantee when that will be. If the code is so bad, why don’t you fix it and send pull requests?
  4. You probably think it’s unmodifiable because according to your GitHub profile, you tried to modify it to be a poller for the steamstat.us API. I have no idea why you thought it would be a good idea to rip the polling code out of a completely unrelated and relatively complex project when it’s very easy to write on your own.
  5. “Because I don’t personally use it, x functionality is useless.” People do use the real-time trading stuff. If you need to be able to add items by something other than their assetid, Array.prototype.filter may be useful.

@serge1peshcoff I would kind of rather just add promise support manually than use Bluebird, which seems like more of a hack to me. I haven’t reviewed your pull request yet, but I will check it later today. If you’ve done it in a good way then I may be willing to accept it instead of preferring to add promise support manually.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deriving the Offer Curve - Clark
As we noted in class, if the price ratio is "low enough", the country will actually import manufactured goods and export agricultural goods....
Read more >
Tropico 5 General Discussions - Trade deals
Of course they offer a good price for exports/imports compared to automated trading for island surplus good. You can click on the ships...
Read more >
Step-by-Step Guide to Exporting - Trade Commissioner Service
The Step-by-Step Guide to Exporting will help you get your business export-ready and well positioned for commercial success abroad.
Read more >
Export Solutions - International Trade Administration
Export Solutions provides practical advice and business tools to help U.S. companies expand in global markets.
Read more >
Release Notes - CSGO Trader
Release notes are meant to explain how to use new features and why certain design or policy decisions were made.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found