onServerStartup () { | |
const { serverId, ip } = getServerInfo() // serverId does not change across restarts | |
this.serverId = serverId | |
// We don't have any routers or producers (yet). Clear any value that exists in the DB related to our serverId | |
clearSharedDB(serverId, 'routers') | |
clearSharedDB(serverId, 'producers') | |
// Update the DB with our serverId and ip so that others will know how to reach us | |
registerServerInDB(serverId, ip) | |
let dragStartX = null; | |
let dragStarted = false; | |
let currentPositionX = 0; | |
function dragStart(e) { | |
// Клик правой кнопкой | |
if (e.button === 2) { | |
return; | |
} |
Note:
When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.
If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:
- Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
A little bit about Node.js API Architecture (Архитектура/паттерны организации кода Node.js приложений)
code: https://github.com/zmts/supra-api-nodejs
Одной из болезней Node.js комьюнити это отсутствие каких либо крупных фреймворков, действительно крупных уровня Symphony/Django/RoR/Spring. Что является причиной все ещё достаточно юного возраста данной технологии. И каждый кузнец кует как умеет ну или как в интернетах посоветовали. Собственно это моя попытка выковать некий свой подход к построению Node.js приложений.
// This is an example of how to fetch external data in response to updated props, | |
// If you are using an async mechanism that does not support cancellation (e.g. a Promise). | |
class ExampleComponent extends React.Component { | |
_currentId = null; | |
state = { | |
externalData: null | |
}; |
Compile with:
webpack --config vendor.webpack.config.js
webpack --config app.webpack.config.js
Use with the following index.html
// The classic AJAX call - dispatch before the request, and after it comes back | |
function myThunkActionCreator(someValue) { | |
return (dispatch, getState) => { | |
dispatch({type : "REQUEST_STARTED"}); | |
myAjaxLib.post("/someEndpoint", {data : someValue}) | |
.then( | |
response => dispatch({type : "REQUEST_SUCCEEDED", payload : response}), | |
error => dispatch({type : "REQUEST_FAILED", error : error}) | |
); |
The issue:
..mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.
(from a new defunct https://developers.google.com/mobile/articles/fast_buttons article)
touch-action
CSS property can be used to disable this behaviour.
touch-action: manipulation
The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.