You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ jqfactory
10
10
##Notable Features
11
11
- Supports jQuery prototype namespacing and event namespacing
12
12
- Includes an elegant, promises-based, solution for plugins that rely on asynchronous behavior on initialization
13
+
- AMD support
13
14
- Implements a simple inheritance paradigm that allows you to reuse methods/properties from other jqfactory plugins using mixins and prototypal inheritance to reuse jqfactory common methods
14
15
- Saves all instance properties with the jQuery `data()` method to easily construct a public API
15
16
- Provides over 10 public/private convenience methods/properties that are useful for plugin development
@@ -655,6 +656,12 @@ __Should I use this instead of the jQueryUI Widget Factory?__
655
656
656
657
_jqfactory_ - Does not allow a widget to directly inherit from another widget. To use another plugin's methods/properties, you must reference all plugin instance properties that are stored on the jQuery namespace. Every plugin inherits from `$.jqfactory.common`.
657
658
659
+
**AMD**:
660
+
661
+
_jQueryUI Widget Factory_ - Does not provide AMD support. **Note:** I talked to the jQueryUI Widget Factory core developer, Scott Gonzalez, recently and he said AMD support will be coming in a future release.
662
+
663
+
_jqfactory_ - AMD is supported. For more information about how to implement this, check out the other FAQ questions.
664
+
658
665
**Events**:
659
666
660
667
_jQueryUI Widget Factory_ - Allows you to add and remove plugin event handlers using the `_on()` and `_off()` methods. Also allows you to trigger events and their associated option callbacks by using the `_trigger()` method.
@@ -681,6 +688,21 @@ __When would I use the _superMethod method?__
681
688
682
689
- If you are creating more than one jQuery plugin, then you can place all of your plugins under one top-level namespace on the jQuery prototype object. This greatly reduces the possibility of running into a naming collision with another jQuery plugin. A great example would be the Twitter Bootstrap library; it would be great if the Bootstrap library placed all of their individual jQuery plugins under a common bootstrap() namespace.
683
690
691
+
__Do you provide AMD support?__
692
+
693
+
- Yes! jqfactory exports a named AMD module called, `jqfactory`, that allows plugin developers to provide AMD support by doing the following:
694
+
695
+
```javascript
696
+
if (typeof define ==='function'&&define.amd) {
697
+
// An AMD loader is on the page. List jquery and the jqfactory as dependencies and register your plugin as an anonymous AMD module.
698
+
define(['jquery', 'jqfactory'], function() {
699
+
// Call your plugin
700
+
});
701
+
} else {
702
+
// An AMD loader is not on the page. Call your plugin.
0 commit comments