{"json_modified": "2016-04-30T06:16:10.253662", "uuid": "35f092e5-f4dd-46fa-92ae-69c018c06f0a", "title": "Creating Reusable Modules", "url": "/en-US/docs/Mozilla/Add-ons/SDK/Tutorials/Creating_reusable_modules", "tags": ["Add-on SDK"], "translations": [{"uuid": "1790aae1-041f-453b-a808-7ced0fed7ab6", "title": "Criando M\u00f3dulos Reutiliz\u00e1veis", "url": "/pt-BR/docs/Mozilla/Add-ons/SDK/Tutorials/Creating_reusable_modules", "tags": ["Add-on SDK"], "summary": "Com o SDK voc\u00ea n\u00e3o precisa manter tudo em um \u00fanico arquivo \"main.js\". Voc\u00ea pode separar seu c\u00f3digo em m\u00f3dulos separados com interfaces claramente definidas entre eles. Voc\u00ea ent\u00e3o importa e usa estes m\u00f3dulos de outras partes de seu add-on usando a declara\u00e7\u00e3o require()
, da mesma forma que voc\u00ea importa os m\u00f3dulos core do SDK como page-mod
or panel
.", "localization_tags": [], "locale": "pt-BR", "last_edit": "2016-01-08T12:31:11", "review_tags": []}], "modified": "2016-04-30T06:16:10", "label": "Creating Reusable Modules", "localization_tags": [], "locale": "en-US", "id": 86037, "last_edit": "2016-04-30T06:16:07", "summary": "With the SDK you don't have to keep all your add-on in a single \"index.js\" file. You can split your code into separate modules with clearly defined interfaces between them. You then import and use these modules from other parts of your add-on using the require()
statement, in exactly that same way that you import core SDK modules like page-mod
or panel
.", "sections": [{"id": "Quick_Links", "title": null}, {"id": "A_hashing_add-on", "title": "A hashing add-on"}, {"id": "File_picker", "title": "File picker"}, {"id": "Hash_function", "title": "Hash function"}, {"id": "Putting_it_together", "title": "Putting it together"}, {"id": "Creating_separate_modules", "title": "Creating separate modules"}, {"id": "filepicker.js", "title": "filepicker.js"}, {"id": "md5.js", "title": "md5.js"}, {"id": "index.js", "title": "index.js"}, {"id": "Distributing_modules", "title": "Distributing modules"}], "slug": "Mozilla/Add-ons/SDK/Tutorials/Creating_reusable_modules", "review_tags": []}