
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
ember-inject-scripts
Advanced tools
Seamlessly inject any sort of scripts inside your ember application
Seamlessly inject any sort of scripts inside your ember application
https://prakashchokalingam.github.io/ember-inject-scripts!
npm install --save ember-inject-scripts
import 'injectScripts' from 'inject-scripts';
let singleScript = {
id: 'vuejs',
src: 'https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js',
attributes: [
{
name: 'data-library',
value: 'vuejs'
}
]
};
injectScripts(singleScript).then(() => {
console.log ( "🤟Yay ! script injected" );
});
---->
<script type="text/javascript" id="vuejs" data-test-script="vuejs" data-library="vuejs"
src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js"></script>
import 'injectScripts' from 'inject-scripts';
let multipleScripts = [
{
id: 'vuejs',
src: 'https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js',
attributes: [
{
name: 'data-library',
value: 'vuejs'
}
],
once: true
},
{
id: 'inline',
inline: `console.log('inline script rendered')`,
attributes: [
{
name: 'data-inline',
value: 'true'
}
]
}
]
injectScripts(multipleScripts).then((events) => {
// events - holds data for all scripts injection as array
console.log ( "🤟🤟🤟Yay ! multiple scripts injected" );
});
---->
<script type="text/javascript" id="vuejs" data-test-script="vuejs" data-library="vuejs"
src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js"></script>
<script type="text/javascript" id="inline" data-test-script="inline" data-inline="true">
console.log('inline script rendered');
</script>
injectScripts function expects object for single script inject and array of objects for multiple scripts injection as parameter, the object items are,
name | type | description |
---|---|---|
id | string : optional | Adds an id attribute to the script element id=id and also creates a test selector data-test-script=id |
type | string : optional : default text/javascript | Adds type to the script element |
src | string : optional | Adds a source to the script element src=src |
inline | string : optional | Adds inline contents to the script element <script> inline </script> |
once | boolean : optional | Looks for an element with the same id passed. If founded avoids the injection and returns the dom element as target |
attributes | Array of objects : optional { name: 'data-inline', value: 'true' } | Adds attribute contents to the script element <script data-inline="true"> inline </script> |
onload | function : optional | Callback function for successive load of script. not available for inline scripts |
onerror | function : optional | Callback function for failure while loading of script. not available for inline scripts |
injectScripts.then() will return all the cacheable event values as array for all passed script elements.
inline scripts will have only target as the event value.
ember serve
npm test
(Runs ember try:each
to test your addon against multiple Ember versions)ember test
ember test --server
ember build
For more information on using ember-cli, visit https://ember-cli.com/.
FAQs
Seamlessly inject any sort of scripts inside your ember application
We found that ember-inject-scripts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.