Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@appsemble/sdk
Advanced tools
Build your own blocks
npm install @appsemble/sdk
bootstrap
The bootstrap function registers a function which gets called every time a new instance of the block is created. If the block returns a DOM Node, it’s attached to the block’s shadow root.
The function may be asynchronous, but should not wait for actions to have finished, as actions are delayed until all blocks on a page are ready.
import { bootstrap } from '@appsemble/sdk';
bootstrap(({ utils }) => {
const root = document.createElement('span');
root.textContent = utils.formatMessage('hello');
return root;
});
Various block settings can be defined by augmenting interfaces in @appsemble/sdk
. This allows you
as a block developer to work in a type safe manner, while providing validation and documentation for
users implementing your block in their app.
Block parameters can be defined by augmenting the @appsemble/sdk#Parameters
interface. The
Appsemble CLI will automatically create a JSON schema from these type definitions. This includes the
TSDoc comments. It’s highly recommended to properly document this interface, as generated
documentation is user-facing. JSON schema properties can be written as TSDoc tags. Markdown is
supported in descriptions.
declare module '@appsemble/sdk' {
interface Parameters {
/**
* This is an example string parameter.
*
* @format email
* @minLength 10
* @maxLength 50
* @pattern ^.+@.*+\..+$
* @example 'Example string'
*/
exampleString: string;
/**
* This is an number parameter.
*
* @type integer
* @minimum 42
* @maximum 1337
* @multipleOf 3
* @example 123
*/
exampleNumber: number;
}
}
Block actions can be defined by augmenting the @appsemble/sdk#Action
interface. Only the action
keys and TSDoc descriptions are used. Markdown is supported in descriptions.
declare module '@appsemble/sdk' {
interface Action {
/**
* This is an example action.
*/
onClick: never;
}
}
Block event emitters can be defined by augmenting the @appsemble/sdk#EventEmitters
interface.
Block event listeners can be defined by augmenting the @appsemble/sdk#EventListeners
interface.
For both emitters and listeners, only the keys and TSDoc descriptions are used. Markdown is
supported in descriptions.
declare module '@appsemble/sdk' {
interface EventEmitters {
/**
* This is an example event emitter.
*/
data: never;
}
interface EventListeners {
/**
* This is an example event listener.
*/
refresh: never;
}
}
Block messages can be defined by augmenting the @appsemble/sdk#Messages
interface. The values of
these properties are used for type safety when calling utils.formatMessage()
. Markdown is
supported in descriptions.
declare module '@appsemble/sdk' {
interface Messages {
/**
* This message doesn’t support variables
*/
bye: never;
}
interface Messages {
/**
* This message accepts a variable named `name`.
*/
hello: {
name: string;
};
}
}
[0.18.24] - 2021-07-29
button-list
): Fix onClick
not being used as the default if an action isn’t specified.markdown
): Fix issue where certain data types would not display correctly.FAQs
Build your own blocks
The npm package @appsemble/sdk receives a total of 360 weekly downloads. As such, @appsemble/sdk popularity was classified as not popular.
We found that @appsemble/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.