Comments (5)
Hallo, natürlich kann ich das machen. Was nutzt du? NodeJS? Oder ganz normal im Browser ?
LG
from dsbapi.
Ich nutze eigentlich einen ganz normalen Webserver... brauche ich Node.js ?
Oder was genau meist du ? :)
from dsbapi.
Nein. Aber ich habe die Library darauf ausgelegt. Ich kann Morgen Abend eine Browser Version pushen und dann ein Beispiel angeben wie du es nutzen kannst. :)
from dsbapi.
Ok danke das wäre nett ^^
from dsbapi.
Ich habe jetzt eine Browser Version commited. Sie befindet sich im Browser Ordner.
Um sie nun zu nutzen, musst du nicht viel tuen.
var dsb = new DSBLib("username", "password");
// Ich weiß nicht ob du weißt wie Promises funktionieren, also erkläre ich es mit und ohne.
// Du hast zwei Möglichkeiten. Einmal die alte API zu nutzen, oder die neue.
// Die neue hat den Nachteil, dass den JSON den du zurück bekommst etwas wirr ist, aber weil das die selbe ist, die auch die Offizielle Seite (http://mobile.dsbcontrol.de/) nutzt, denke ich, wird die am längsten verfügbar sein.
// Die alte hat den Vorteil sie ist sehr einfach zu verstehen, aber es könnte sein das sie in Zukunft obsolet wird.
// Die alte (mit Promise):
dsb.getDataV1().then(function(Data) {
console.log(Data);
}).catch(console.error);
// Mit callback
dsb.getDataV1(function(error, Data) {
if (!error) {
console.log(Data);
} else {
console.error(error);
}
});
// Die neue (mit Promise)
dsb.getData().then(function(Data) {
console.log(Data);
}).catch(console.error);
// Mit callback
dsb.getData(function(error, Data) {
if (!error) {
console.log(Data);
} else {
console.error(error);
}
});
Ich habe die Browser Version jetzt nicht getestet, aber so sollte es gehen. Ich weiß auch nicht so wirklich wieso man es Client Seitig nutzen sollte. Ich habe es eher als Server Library ausgelegt.
from dsbapi.
Related Issues (20)
- Optimize Promise getData()
- Better browser compatibility
- Use async/await
- Write real tests
- Remove bluebird dependency
- Remove async dependency
- Remove optional-callback dependency
- Remove request-progress & request and replace it
- No licence chosen! HOT 2
- Action required: Greenkeeper could not be activated 🚨
- Action required: Greenkeeper could not be activated 🚨
- An in-range update of joi is breaking the build 🚨 HOT 3
- An in-range update of mocha is breaking the build 🚨 HOT 5
- An in-range update of jsdoc is breaking the build 🚨 HOT 2
- An in-range update of rollup is breaking the build 🚨 HOT 1
- An in-range update of mocha is breaking the build 🚨 HOT 1
- IPhone API down HOT 2
- Example does not work HOT 3
- An in-range update of axios is breaking the build 🚨 HOT 1
- API Benutzung
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dsbapi.