Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

scraperwiki.save_var equivalent in scraperwiki.js #400

Closed
zarino opened this issue Aug 28, 2013 · 2 comments
Closed

scraperwiki.save_var equivalent in scraperwiki.js #400

zarino opened this issue Aug 28, 2013 · 2 comments

Comments

@zarino
Copy link
Contributor

zarino commented Aug 28, 2013

See Paul's suggestion in sensiblecodeio/scraperwiki-python#35 for rationale.

The interface should be the same in both Python and JavaScript.

The JavaScript version would look something like:

// saves latest_id and 14 into SQLite DB
scraperwiki.var["latest_id"] = 14

// logs "14"
console.log(scraperwiki.var["latest_id"])
@zarino
Copy link
Contributor Author

zarino commented Sep 9, 2013

It looks like traditional JavaScript doesn't let you define 'catch-all' setters, making it somewhat difficult to fire off events (like saving to a database) when items are added to your dictionary-like object: http://stackoverflow.com/questions/7891937/is-it-possible-to-implement-dynamic-getters-setters-in-javascript

We could probably use object.defineProperty() if we were happy for scraperwiki.js to drop IE8 support. But we're not.

@drj11
Copy link
Contributor

drj11 commented Jan 2, 2014

Not a high enough priority.

@drj11 drj11 closed this as completed Jan 2, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants