Hi I am hoping someone can help me here :) I am trying to setup a library similar in fashion to jQuery. Here is what I have so far.
/*!
* Sentinal Javascript Library V1.0.0
* http://sentinal.com
*
* Depends on jQuery v1.9.1
*
* Copyright 2013 Sentinal Team and other contributors
* Released under license
* http://sentinal.com/license
*
* Date 25-3-2013
*/
(function ( window, location, $, undefined ){
// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335)
// Support: Firefox 18+
//"use strict";
var
// A central reference to the root Sentinal(document)
rootSentinal,
// Use the correct document accordingly with window argument (sandbox)
document = window.document,
location = window.location,
// Map over Sentinal in case of overwrite
_Sentinal = window.Sentinal,
// Map over the $S alias in case of overwrite (Namespace alias for Sentinal)
_$S = window.$S,
// Version of this library
core_version = "1.0.0",
// Define a local copy of Sentinal
Sentinal = function() {
// The Sentinal object is actually just the init constructor 'enhanced'
return new Sentinal.fn.init();
};
Sentinal.fn = Sentinal.prototype = {
// The current version of Sentinal being used
Sentinal: core_version,
constructor: Sentinal,
init: function (){
$(document).ready(function(){
$('body').append('<h1>It Works!</h1>');
console.log( "Sentinal Version is reporting : " + $S.fn.version() );
});
},
version: function (){
return core_version;
},
render: function (){
},
send: function () {
},
recieve: function () {
}
};
// Give the init function the jQuery prototype for later instantiation
Sentinal.fn.init.prototype = Sentinal.fn;
window.Sentinal = window.$S = Sentinal;
})( window, location, jQuery );
The problem I have at the minute is either to do with my library not being aware of $(document).ready. Or a scoping issue but the init method that has some jQuery in it will not append the html to the body of the document and also the console.log is not working either.
Any information will be greatly received :)