From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/pl/mozilla/javascript_tips/index.html | 110 ++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 files/pl/mozilla/javascript_tips/index.html (limited to 'files/pl/mozilla/javascript_tips/index.html') diff --git a/files/pl/mozilla/javascript_tips/index.html b/files/pl/mozilla/javascript_tips/index.html new file mode 100644 index 0000000000..b4b57fa8e1 --- /dev/null +++ b/files/pl/mozilla/javascript_tips/index.html @@ -0,0 +1,110 @@ +--- +title: JavaScript Tips +slug: Mozilla/JavaScript_Tips +translation_of: Mozilla/JavaScript_Tips +--- +

XUL Tips

+ + + +
var UniqueName = {
+  _privateMember: 3,
+  publicMember: "A string",
+
+  init: function() {
+    this.doSomething(this.anotherMember);
+  },
+
+  doSomething: function(aParam) {
+    alert(aParam);
+  }
+};
+
+ +

XPConnect

+ + + +
if (target instanceof Components.interfaces.nsIRDFResource)
+  return target.Value;
+if (target instanceof Components.interfaces.nsIRDFLiteral)
+  return target.Value;
+return null;
+
+ + + +
var weakObserver = {
+  QueryInterface: function QueryInterface(aIID) {
+    if (aIID.equals(Components.interfaces.nsIObserver) ||
+        aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
+        aIID.equals(Components.interfaces.nsISupports))
+       return this;
+    throw Components.results.NS_NOINTERFACE;
+  },
+  observe: function observe(aSubject, aTopic, aState) {
+  }
+}
+
+ + + +

DOM elements

+ + + +

References

+ + -- cgit v1.2.3-54-g00ecf