✨ MAJOR FEATURES: • Auto-zoom intelligence với smart bounds fitting • Enhanced 3D GPS markers với pulsing effects • Professional route display với 6-layer rendering • Status-based parking icons với availability indicators • Production-ready build optimizations 🗺️ AUTO-ZOOM FEATURES: • Smart bounds fitting cho GPS + selected parking • Adaptive padding (50px) cho visual balance • Max zoom control (level 16) để tránh quá gần • Dynamic centering khi không có selection 🎨 ENHANCED VISUALS: • 3D GPS marker với multi-layer pulse effects • Advanced parking icons với status colors • Selection highlighting với animation • Dimming system cho non-selected items 🛣️ ROUTE SYSTEM: • OpenRouteService API integration • Multi-layer route rendering (glow, shadow, main, animated) • Real-time distance & duration calculation • Visual route info trong popup 📱 PRODUCTION READY: • SSR safe với dynamic imports • Build errors resolved • Global deployment via Vercel • Optimized performance 🌍 DEPLOYMENT: • Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app • Bundle size: 22.8 kB optimized • Global CDN distribution • HTTPS enabled 💾 VERSION CONTROL: • MapView-v2.0.tsx backup created • MAPVIEW_VERSIONS.md documentation • Full version history tracking
80 lines
2.1 KiB
Markdown
80 lines
2.1 KiB
Markdown
Run Async
|
|
=========
|
|
|
|
[](http://badge.fury.io/js/run-async) [](http://travis-ci.org/SBoudrias/run-async) [](https://david-dm.org/SBoudrias/run-async)
|
|
|
|
Utility method to run a function either synchronously or asynchronously using a series of common patterns. This is useful for library author accepting sync or async functions as parameter. `runAsync` will always run them as an async method, and normalize the multiple signature.
|
|
|
|
Installation
|
|
=========
|
|
|
|
```bash
|
|
npm install --save run-async
|
|
```
|
|
|
|
Usage
|
|
=========
|
|
|
|
Here's a simple example print the function results and three options a user can provide a function.
|
|
|
|
```js
|
|
var runAsync = require('run-async');
|
|
|
|
var printAfter = function (func) {
|
|
var cb = function (err, returnValue) {
|
|
console.log(returnValue);
|
|
};
|
|
runAsync(func, cb)(/* arguments for func */);
|
|
};
|
|
```
|
|
|
|
#### Using `this.async`
|
|
```js
|
|
printAfter(function () {
|
|
var done = this.async();
|
|
|
|
setTimeout(function () {
|
|
done(null, 'done running with callback');
|
|
}, 10);
|
|
});
|
|
```
|
|
|
|
#### Returning a promise
|
|
```js
|
|
printAfter(function () {
|
|
return new Promise(function (resolve, reject) {
|
|
resolve('done running with promises');
|
|
});
|
|
});
|
|
```
|
|
|
|
#### Synchronous function
|
|
```js
|
|
printAfter(function () {
|
|
return 'done running sync function';
|
|
});
|
|
```
|
|
|
|
### runAsync.cb
|
|
|
|
`runAsync.cb` supports all the function types that `runAsync` does and additionally a traditional **callback as the last argument** signature:
|
|
|
|
```js
|
|
var runAsync = require('run-async');
|
|
|
|
// IMPORTANT: The wrapped function must have a fixed number of parameters.
|
|
runAsync.cb(function(a, b, cb) {
|
|
cb(null, a + b);
|
|
}, function(err, result) {
|
|
console.log(result)
|
|
})(1, 2)
|
|
```
|
|
|
|
If your version of node support Promises natively (node >= 0.12), `runAsync` will return a promise. Example: `runAsync(func)(arg1, arg2).then(cb)`
|
|
|
|
Licence
|
|
========
|
|
|
|
Copyright (c) 2014 Simon Boudrias (twitter: @vaxilart)
|
|
Licensed under the MIT license.
|