Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@scalecube/browser
Advanced tools
[![Join the chat at https://gitter.im/scalecube-js/Lobby](https://badges.gitter.im/scalecube-js/Lobby.svg)](https://gitter.im/scalecube-js/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
This is part of scalecube-js project, see more at https://github.com/scalecube/scalecube-js
Full documentation
This package provides Scalecube's solution with default setting for working in browsers.
yarn add @scalecube/browser
or npm i @scalecube/browser
import { createMicroservice, ASYNC_MODEL_TYPES } from '@scalecube/browser';
create a seed
export const MySeedAddress: 'seed';
// Create a service
createMicroservice({
address : MySeedAddress
});
Create a service
// Create service definition
export const greetingServiceDefinition = {
serviceName: 'GreetingService',
methods: {
hello: {
asyncModel: ASYNC_MODEL_TYPES.REQUEST_RESPONSE,
}
},
};
// Create a service
createMicroservice({
service : [{
definition: greetingServiceDefinition,
reference: {
hello : (name) => `Hello ${name}`
},
}],
seedAddress : MySeedAddress
});
Use a service
const microservice = createMicroservice({seedAddress : MySeedAddress})
// With proxy
const greetingService = microservice.createProxy({
serviceDefinition: greetingServiceDefinition
});
greetingService.hello('ME').then(console.log) // Hello ME
We let Scalecube choose our addresses for us, we know only the seed address.
After we connected to the seed we will see the whole cluster.
In the browser we don't need to import modules, we can create multiple bundles, scalecube will discover the available services
Dependency Injection
createMicroservice({
seedAddress : MySeedAddress,
services: [
{
definition: serviceB,
reference: ({ createProxy, createServiceCall }) => {
const greetingService = createProxy({serviceDefinition: greetingServiceDefinition });
return new ServiceB(greetingService);
}
}
]
})
please Read before starting to work with scalecube.
this package already transpile the code to es5.
for old browser support please add:
<script nomodule src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.6.0/polyfill.min.js"></script>
<script nomodule src="https://cdn.jsdelivr.net/npm/proxy-polyfill@0.3.0/proxy.min.js"></script>
FAQs
[![Join the chat at https://gitter.im/scalecube-js/Lobby](https://badges.gitter.im/scalecube-js/Lobby.svg)](https://gitter.im/scalecube-js/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
The npm package @scalecube/browser receives a total of 2 weekly downloads. As such, @scalecube/browser popularity was classified as not popular.
We found that @scalecube/browser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.