-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
30 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,39 @@ | ||
<blockquote class="lang-specific javascript--browser"> | ||
<p>The JavaScript library offers several overloaded version | ||
<blockquote class="lang-specific javascript--node"> | ||
<p>The Node.js library offers several overloaded versions | ||
of the <code class="prettyprint">temporalData</code> method.</p> | ||
</blockquote> | ||
|
||
<blockquote class="lang-specific javascript--browser"> | ||
<h3>Callback only</h3> | ||
<p>If a single callback is provided, the library retrieves other available information | ||
from the client automatically, e.g., the user-agent, the location (if and only if shared), or | ||
the ipAddress.</p> | ||
</blockquote> | ||
|
||
> | ||
```javascript--browser | ||
Breinify.temporalData(function(data) { | ||
```javascript--node | ||
var latitude = 37.7749; | ||
var longitude = -122.4194; | ||
Breinify.temporalData(latitude, longitude, function(data) { | ||
console.log(data); | ||
}); | ||
``` | ||
|
||
<blockquote class="lang-specific javascript--browser"> | ||
<h3>Providing a User Instance</h3> | ||
<p>Another possibility is to provide a user object manually. This is typically done, if | ||
some specific temporal data should be resolved, e.g., a location based on a free text, | ||
a pair of coordinates (latitude/longitude), or a specific ip-address. Have a look at the | ||
<a href="#example-use-cases">further use cases</a> to see other examples.</p> | ||
</blockquote> | ||
|
||
> | ||
```javascript--browser | ||
var q = { additional: { ipAddress: '72.229.28.185' }}; | ||
Breinify.temporalData(q, function(data) { | ||
```javascript--node | ||
var ipAddress = '72.229.28.185'; | ||
Breinify.temporalData(ipAddress, function(data) { | ||
console.log(data); | ||
}); | ||
``` | ||
|
||
> | ||
```javascript--node | ||
// you can also pass in a more complex location object | ||
var loc1 = { | ||
'text': 'San Diego' | ||
}; | ||
Breinify.temporalData({ 'location': loc1 }, function(data) { | ||
console.log(data); | ||
}); | ||
var loc2 = { | ||
'latitude': 37.7749, | ||
'longitude': -122.4194 | ||
}; | ||
Breinify.temporalData({ 'location': loc2 }, function(data) { | ||
console.log(data); | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters