equivalent of navigator.bluetooth.requestdevice() in react native - javascript

I am converting a vanilla project into react native and got stuck in this finding equivalent of navigator.bluetooth.requestdevice() in react native.
I have tried packages like https://github.com/innoveit/react-native-ble-manager but the problem is I have the code of that web project and finding this alternative can solve many tasks.

anyone who is trying to configure BLE in reacts native application but doesn't have a full idea about it let me give you a brief explanation as I was one of you.
There are not many packages out there with the maintained author so you have to rely on this https://github.com/innoveit/react-native-ble-manager package only or you have to get a response back from the natively build package by your self...
but not to worry because there aren't any major changes and its GitHub page is well-documented.
in my case, I was looking for a specific services id and Specific characteristic id to locate while looking for devices.. this package has serval events that can help you with it.. if you need detailed explanations please comment on this..

Related

How to Broadcast (From one to multiple peers) using Webrtc and Firebase

I know that firebase can be used with webrtc and I was easily able to go through creating a one to one video-audio calling webapp.
I'm Trying to Create a One to several peer broadcasting system,(like twitch) and when i tried to know how it can be done, i found this, its pretty old and i cant figure out how i can implement it with firebase.
If there are any npm packages which can help me achieve this or any guide I can refer to, it would be great if you could share them. I'm using ReactJS.
I haven't created a WebRTC + firebase one-to-many streaming application myself yet, but here are a few resources I'd look at if I was:
Coding with Chaim
Doug TV site walkthrough
awesome-webrtc repository has a lot of gems
Since you asked about other npm packages, there's also daily-js, but I'm biased. Full disclosure: I work at Daily. You could use the daily-js call object to handle some of the WebRTC complexity. We built a React + daily-js webinar, which could be similar to the one-to-many use case you're building (here's the first blog post and sample code).

Best solution to share code between 2 separate projects React Js and React Native? ( like redux store) [duplicate]

This question already has answers here:
React Native + React (for web) seed project
(6 answers)
Closed 4 years ago.
For a project, we need to have a Website and a mobile App (not a responsive Website) that both will consume my API. I used to work with React so I've checked a lot about React-Native for the mobile App part.
As I may understand, this require to create 2 distincts projects and it seems more efficient to do so (furthermore if these 2 projects don't share the same client). The problem is that, at a first look, both will use the same store... I don't want to dupplicate my store neither update both of them each time I update my API... The only difference I see between my React Website and my React Native App is the way they render. They will both have same functionalities. Can we go further by hypothesis that they will also share the same containers?
I try to open an issue on the github but they redirect me here to discuss about it.
So I want to know if you guys have THE best solution (clean & without bad surprises) to share code between React and React Native? If so, a tutorial will be very appreciate.
(Note: Searches were very time-consuming, React Native documentation should reserve a section about this subject...)
This was answered in this thread.
The overall idea is to have different entrypoints for each platform, and have the platform specific code (React for web and React Native for mobile) share common code like the Redux store.
An in-depth article can also be found in the thread I linked.
That being said, there are a number of tradeoffs and pitfalls to this idea one of them being dependency management, as you can see by this comment from the linked article:
I've just learned the shortcoming of this structure. By sharing a common package.json between native and web, you've glued them together by their common dependencies, the most important one being react. Let's say you upgrade to a version of react-native that depends on >= react#16, but your web app depends on some other library which depends on =< react#15. This exact thing has just happened to me, and I'm not finding an easy way out.
Another viable approach would be to transform the common areas of code into libraries you can export and import them to each separate project (mobile and web). That way you avoid the problems with the first option, but now you still have to maintain and update two separate code repos.
To answer your question the comments: I don't think there's anything wrong with having one project sharing code for both platforms, but it has to be planned very carefully so you won't break both your projects when trying to add new things. Try to start by planning your project structure so there's clear separation between web and mobile code and check if your dependencies are compatible with one another.
Here's a blog post that has an example project that should help you with designing your project.
EDIT: You could try React Native Web, but that's still in alpha so I wouldn't recommend it for work related projects (should be ok for school/personal projects though).

Testing Javascript (Server: Node.js, Client: React - Redux - Saga)

A quick disclaimer: I am not having issues, I am simply asking for guidance. I don't feel like the other topics provide a guiding point towards a particular style of testing or library rather than just helping other with their actual choice of library and style.
Hey guys! I was thinking, is there anyone in here that could provide me with some guidance for unit testing? What kind of testing do I want (I am a newbie)? e2e, tdd, bdd etc.? Any particular recommendations for libraries and good practices? I am currently working on a React Redux-Saga project and a node backend that we'd like to start testing as well. Is there library that we can use for both or do we need two different since it is essentially two different projects (Client, Server).
There are plenty of test runners out there, I would recommend using Jest its easy to setup full featured and has good documentation and maintained by Facebook. Enzyme is the de facto standard for parsing react components and traversing the DOM, although is just a wrapper around Reacts native test utils.
https://facebook.github.io/jest/
https://github.com/airbnb/enzyme
You don't need different testing libraries for client and server code at a unit level. Although for end to end testing / integration testing you do need a different runner generally one that includes selenium, although there are some great alternatives out there at the moment.
Here is a doc I put together outlining some React testing fundamentals
cypress.io looks like an interesting new platform for writing end to end test without the need for selenium making it faster and more stable.
jest is a very good option if you're working with both nodejs and react.
For a good practice, I would recommend trying to apply Clean Architecture so that your source code will have good separation of concerns and testability.

Can I use meteor.js just for back end

I have to build a mobile app that's needs a high level of reactivity. I thought to use meteor.js just for my back end and build the app using native technologies. Can this work?
Yes it can, but you need to evaluate how reliable it will be.
If you're thinking about using JavaScript to write your native app (e.g. React Native) then you have good NPM packages that can help you with this task. For example:
https://blog.meteor.com/leverage-the-power-of-meteor-with-any-client-side-framework-bfb909141008
But if you're thinking about writing completely native code for iOS and Android and still have a DDP connection to use everything from Meteor you'll need to find a third part library written for your platform.
I've tried this in the past and had a bad experience. Once Meteor started getting updates the library broke and my app would not work anymore. This means you would need to find a well maintained project that is always up to date.
I hope I could help a little. It's not a simple decision, but if you research hard enough you can find out what's the best way to do it.
I advice you give it up if you wanna an app with high reactivity and high performance.

Javascript Git client

Is there a Javascript implementation of Git?
I'm wanting to use HTML5 to create a rich Javascript application and have the idea that I could use git to track changes to the data. So, I'm wondering if there is a javascript implementation of a git client, or maybe some way of controlling a git repository by making POST requests.
Check out: https://github.com/danlucraft/git.js
A pure js implementation of git in javascript.
This https://github.com/creationix/js-git is and will be the future!
It is backed by a kickstarter campaign and has a very sound software design.
Many of the client use-cases such as git clone have been implemented
According the answer to my question on the issue tracker [1]. The author also plans to implement parts of the server side stuff to allow you to build a server with it.
https://github.com/creationix/js-git/issues/33
You can use https://github.com/isomorphic-git/isomorphic-git
isomorphic-git is a pure JavaScript reimplementation of git that works in both Node.js and browser JavaScript environments. It can read and write to git repositories, fetch from and push to git remotes (such as GitHub), all without any native C++ module
isomorphic-git is a continuation of https://github.com/creationix/js-git
isomorphic-git would not have been possible without the pioneering work by
#creationix and #chrisdickinson. Git is a tricky binary mess, and without
their examples (and their modules!) I would not have been able to come even
close to finishing this. They are geniuses ahead of their time.
Related questions:
Run git push from javascript hosted in static site
How to implement Git in pure Javascript to create a GUI?
I guess it depends on what you need, but there's a few related projects out there.
The most "robust" implementation I can think of is this one by the 280North crew (of Cappuccino fame).
There's also some server-side JavaScript projects underway (e.g., http://github.com/ajaxorg/node-github), but that won't run entirely within a browser client.
Update (for anyone else who comes across this):
Please be sure to check out vanthome's answer. Tim Caswell's js-git project is well funded and undoubtedly the best answer here at this time.
I just recently wrote a Git client called Nougit. Maybe this resembles something you are looking for?
$ npm install nougit
https://github.com/gordonwritescode/nougit
This is a full GUI, but the module inside named "git.js" is an API I wrote specifically to do what you are describing. Yank out the file, and you can use express to handle the http routes.

Categories