Created
October 21, 2013 08:13
-
-
Save tuvokki/7080299 to your computer and use it in GitHub Desktop.
Script by Stijn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var test, something; | |
function privateFunc() { | |
}; | |
var myObject = { | |
myMethod: function() {privateFunc.apply(this, []);} | |
}; | |
window.myObject = myObject; | |
window.Planon = window.Planon || {}; | |
Planon.myFunction = function myFunction() {alert("my function!");}; | |
// Expose | |
/// ------------------------------------------------- | |
window.Planon = window.Planon || {}; | |
var test = function() {return "Hello!"}; | |
Planon.PnFrame = { | |
test: "MyField", | |
testSomething: function testSomething() { | |
return test(); | |
} | |
}; | |
Planon.PnFrame.testSomething = function testSomething() { | |
alert(this.test); | |
} | |
})(); | |
// alert(Planon.PnFrame.testSomething()); | |
function myConstructor(text) { | |
this.test += text; | |
} | |
myConstructor.prototype.test = "Wow!"; | |
var myObj = new myConstructor("Great!"); | |
// alert(myObj.test); | |
function Base ( ) { | |
// ... | |
this.color = "blue"; | |
// ... | |
} | |
function Sub ( ) { | |
this.color = "red"; | |
alert("Other? " + this.other); // ?? | |
} | |
Sub.prototype = new Base( ); | |
var sub0 = new Sub(); | |
sub0.other; | |
Base.prototype.other = "Bye!"; | |
Sub.prototype.showColor = function ( ) { | |
alert("Sub color:" + this.color); //red or blue??? | |
} | |
alert("Sub proto color:" + Sub.prototype.color); | |
var sub = new Sub(); | |
sub.showColor(); | |
// console.log("Sub color: ", Sub.showColor()); | |
var myBrowser = "IE"; | |
function doSpiffyThings() { | |
alert("Spiffy stuff!"); | |
} | |
if (myBrowser != "Chrome") { | |
doSpiffyThings = function doSpiffyThings() { | |
alert("Can only do spiffy stuff in Chrome"); | |
} | |
} | |
doSpiffyThings(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment