Hello! We’ve noticed that you haven’t made any recent edits on your wiki this year. This is a notice that your wiki is eligible for removal. Click here to learn more about the criteria for wiki removal.
This page describes one or more aspects related to the development of the Railgun script. Developers may find this content helpful, but it may not be very interesting to the average end-user of the script.
Railgun modules always have a method called init() which initializes the properties of that module. This method accepts no parameters and returns nothing, and is similar to a default constructor. At bare minimum, init() is expected to initialize the Module.section property.
Sample init() method[]
Railgun.MyModule={// localStorage keymyKey:[],// a constant propertythis.myButton:'<button></button>',// the init() methodinit:function(){// how to prevent your module from loading under certain conditionsif("some page"===wgPageName)return;// how to initialize localStorage datathis.myKey=Railgun.Storage.storageState.myKey||[];// create the HTML for your module inside section tagsvarh1='<h1>My Module</h1>';varmoduleBodyHTML='<table><tr><td>'+this.myButton+'</td></tr></table>';// IMPORTANT! -- initialize the 'section' property// <section> tag MUST have the "module" CSS classthis.section='<section class="railgun-mymodule-module module">'+h1+moduleBodyHTML+'</section>';}}