On GitHub, find a sea.js modular project, read the source when there is a place that does not understand:
In the Demo.js
Definefunction(Require, exports, module) {varJQuery = require ("jquery-2.0.3"); varv = require ('.. /base/version '); varD = require (' Util/convert/date '); varm = require (' Util/map/baidu-map '); Require (' Sweetalert '); Console.log ("Enter:", module.id); var$output = $ (' #output '); $('. Title ', $output). html (V.desc + "-" +v.version); $('. Version-info DT ', $output). html (V.powerby); $('. Version-info dd ', $output). HTML ("This is written by Seajs referencing jquery. "); $(' #output '). On (' click ',function() {Swal ("Version number:" + v.version + "\ n" + "" + V.powerby + "\ n" + "Introduction:" +V.desc); }); SetInterval (function() { $(' #nowDate '). HTML (D.dateformat (' + (NewDate ()), ' Yyyy-mm-dd hh:mm:ss ')); }, 1000); /*----Get geolocation coordinates Start----*/ varOptions ={enablehighaccuracy:true, Maximumage:1000 } //navigator.geolocation Getting coordinates if(navigator.geolocation) {Console.log ("Browser Support Geolocation"); Navigator.geolocation.getCurrentPosition (onsuccess, OnError, Options); } Else{Console.log ("Browser does not support geolocation"); } //when the coordinates are obtained successfully functiononsuccess (position) {varlongitude = position.coords.longitude;//Longitude varlatitude = position.coords.latitude;//Latitudeconsole.log (longitude, latitude); M.initmap (' Map ', longitude, latitude);//Initialize MapM.addmarker (longitude, latitude);//Add Overlay}
Sea Modular require