How to use multiples Parse instance - javascript

Is there a way to initialize multiple parse apps in react javascript, currently i am initializing single parse app like this
Parse.initialize(config.appId);
Parse.serverURL = config.serverURL;

Currently with the implementation of the SDK you cannot do that. Theses methods and properties are static as you can see here
What you can do is to use the REST API
You can also suggest this feature on the GitHub repository

Related

dynamic fetch of localized strings from the server react-native

I want to make react-native app multilingual I use react-native-localization library and i use for JSON formats to store translations.
my question is it possible to change JSON strings dynamically for example by adding new language or changing the translation already exist
The feature you can use is Code Push here you will be updating the source JS files. if you use a dynamic JSON you will have to request it every time but using codepush you can update the source JSON itself.
More info
https://github.com/Microsoft/code-push/
You can use RN Localization setContent method, after using local strings. Check the docs:
Update / Overwrite Locale
You might have default localized in the
build but then download the latest localization strings from a server.
Use setContent to overwrite the whole object. NOTE that this will
remove all other localizations if used.
strings.setContent({
en:{
how:"How do you want your egg todajsie?",
boiledEgg:"Boiled eggsie",
softBoiledEgg:"Soft-boiled egg",
choice:"How to choose the egg"
}
})

ReactiveX/RxJS 5 in the browser without any loaders?

How do you load RxJS in an old javascript application which does not use any loaders?
For RxJS 4.x I could simply do it like this:
<script src="//cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.7/rx.lite.min.js"></script>
What about RxJS 5? Their documentation assumes that you are using some kind of loader that will take care of everything, but for the intermediate step for legacy application when there is no loader, just files packed at build time?
They also mention ability to create your own bundle by including only the functions you use for "size-sensitive bundling" which sounds great.
So should i just create an entry point file and then add it to my build process and use some kind of tool (browserify/gluejs/webmake) to build everything into a single file that as in RxJS4 would expose Rx (or simply Observable) as global variable?, eg:
// run this through some tool to make it available in browser simply as Observable
var Observable = require('rxjs/Observable').Observable;
require('rxjs/add/operator/map');
exports=Observable
As same as RxJS 4, RxJS 5 also provides umd builds via cdn can be embeded without requiring any module loader like
<script src="https://npmcdn.com/#reactivex/rxjs#5.0.0-beta.6/dist/global/Rx.umd.js"></script>
then Rx will be global variable you can access anywhere.
You may refer CDN hosted build description at https://github.com/ReactiveX/rxjs#cdn .

How to create JS library by scala-js

How can I create a JS library in scala-js? I am using standard Play/Scala server + scala-js client with shared objects. I want my library to be on URI /api/mylib.js.
I don't know how make scala-js client project without main method. Also how to generate scala-js code to the specific URL I need.
To write a JS library, you need to export the public API to JavaScript.
You will also likely want to disable the generation of the "launcher", which looks for a JSApp in your classpath and calls its main method. Otherwise fastOptJS will complain that it cannot find any JSApp. You can do this with the following sbt setting:
persistLauncher := false
Edit: See also the blog post How to make an idiomatic Javascript library with Scala.js

Is it possible to configure parse.com as backend instead of mongodb using generator "yo meanjs"?

i am new to MEAN js stack and was curious if there is a way to hook up parse.com as backend thru auto generated code via meanjs so i can access parse objects and execute queries
by default yo meanjs generators creates mongodb backend. i want to access parse.com data instead
any pointers would be highly appreciated - thanks
Yes. But not with the generator. Best path would be to use:
https://github.com/DaftMonk/generator-angular-fullstack with Database: None
Then use the parse REST API or JavaScript SDK. It is very simple to use as is.
http://blog.parse.com/learn/engineering/the-javascript-sdk-in-node-js/

What is the best way to handle i18n in an Angular app with dynamic translations

So I have been tasked with i18n on a new Angular app we are creating. I already know how to implement it if the translations are stored in json format on the client. However I have been told I cannot implement it like this as the translations will get updated on a regular basis by the client so must will have to be got from the api.
I have also been told that I cannot map directly to the json response, but instead I must create TypeScript objects which sit between the json and the UI.
What is the best way to achieve this? The header has a dropdown for languages. Do I need to call all the languages when the application loads and cache them, or do I just call each language as I need to? Do I translate only what I see on screen or does the entire app need to be translated?
do I just call each language as I need to
Definitely only the ones you need.
Do I translate only what I see on screen or does the entire app need to be translated
The relevant portions get redirected to an in memory i18n angular service that has the results cached.

Categories

Resources