
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
#bootjS
##Introduction
bootJS is used by SPEAK in order to parse the DOM, create the appropriate components and executing pageCodes.
bootJS size minified and gzip is just 8KB !
There is no dependency on jQuery, Backbone, Knockout, Underscore but it does not mean you can't use them in your component.
##What bootJS is not ?
##What bootJS is ?
##Development
###Re-generate the file
If you want to change the code of bootJS and rebuild it, you will need to install node.js (with npm).
As soon as you have node.js installed, you can go to the directory where bootJS's source code is and execute:
npm install
This will install all the dependencies needed by the project in order to generate the files and execute the tests.
When done, to generate the dist file, you can execute:
on windows
grunt.cmd
on mac os or linux
grunt
###Coding Style
####commonJS
We have applied the commonJS pattern for splitting the code into different modules. We use a tool called "browserify" in order to reassemble the code into one file supported by the browser.
index.js is the main file.
####Comments We use the docBlockR notation for our comments.
####Styles
We use JSformatter to automatically format the JS code as we have decided.
####Configuration
You can find those configurations inside the "conf" folder of our structureJS repository.
####Documentation
You will find in the docs folder, a doc website generated based on the comments written in the Code.
####Test
The test folder has all the tests that can be run inside a node.js environment. The testClient folder has all the tests that must be run in the browser (we use phantomjs for executing them automatically).
To run the test:
grunt test
##Component
SPEAK is all about components, in a case you want special behaviour for a component, you will need to register this behaviour using the component method.
###Object literal
You can use object literal notation.
sitecore.component({
name: "name", //required
initialize: function() {
this.test = true;
},
doSomething: function() {
alert("Hello World");
}
});
###Class
You can also pass a pure javascript object or a typescript class to the component method. In that case you will need to pass the name of the component as a parameter at the end.
class MyTypescriptClass {
initialize() {
this.isInitialize = true;
this.isInitialized = true;
}
}
sitecore.component(MyTypescriptClass, "MyTypescriptClass");
###Depedencies
If you need some dependencies for your component. You can pass those in the first parameter using an array.
sitecore.component(["/path/to/deps1", "/path/to/deps2"], { name: "MyComponent" initialize: function () { this.test = "Hello World" } });
##PageCode
To register a pageCode using bootJS, you will need to use the pageCode method.
sitecore.pageCode({
initialize: function() {
this.Component01.test = "Wouhou!";
}
});
###Depedencies
If you need some dependencies for your pageCode. You can pass those in the first parameter using an array.
sitecore.pageCode(["/path/to/deps1", "/path/to/deps2"], {
initialize: function() {
this.Component01.test = "Wouhou!";
}
});
##Plugins
A plugin is an object which can extend all the components inside your page and/or all the applications inside your page.
Here is a basic example, on how to create a plugin for adding jQuery.
sitecore.plugin(["path/to/jQuery"], {
extendComponent: function(component) {
component.$el = $(component.el);
},
extendApplication: function(app) {
app.$el = $(app.el);
}
});
Please note, those code wil be executed just after your initialize method.
##Presenter
A presenter lets you use the framework of your choice in order to add shared behaviour for a set of components.
sitecore.presenter(["path/to/knockout"], {
initialize: function() {
this.createViewModel();
},
createViewModel: function () {
//some magics
}
});
##Property
This method is used by SPEAK in order to register custome type for your property.
Here is an example of a property which could expose a property fullName constructed by the firstname and lastname property present inside your component.
sitecore.propertyType( {
name: "fullname",
get: function () {
return this.component.firstname + " " + this.component.lastname;
}
} );
##more to come
FAQs
This project is used to demonstrate how you should write a module in SPEAK
We found that sitecore 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.