6464 } , init ) ;
6565 }
6666
67- scope . Sync = function ( endpoint , options , data , domHook , saveResponse ) {
67+ scope . Sync = function ( endpoint , options , data , domHook , saveResponse , plugins ) {
6868 this . _eventPrefix = _eventPrefix ;
6969 this . endpoint = endpoint || "/" ;
7070 this . options = DataUtils . copy ( {
7979 this . saveResponse = ( typeof saveResponse === "boolean" ) ? saveResponse : true ;
8080
8181 this . _ajax = new Ajax ( ) ;
82- this . _plugin = new AjaxPlugin ( ) ;
82+ this . _plugin = new AjaxPlugin ( this . plugins || [
83+ new AjaxCSRFPlugin ( { } , "csrf" ) ,
84+ new AjaxBusterPlugin ( { } , "buster" ) ,
85+ new AjaxAPIPlugin ( { } , "api" ) ,
86+ new AjaxPagePlugin ( { } , "page" ) ,
87+ ] ) ;
8388
84- this . _plugin . register ( "csrf" , AjaxCSRFPlugin ) ;
85- this . _plugin . register ( "buster" , AjaxBusterPlugin ) ;
86- this . _plugin . register ( "api" , AjaxAPIPlugin ) ;
87- this . _plugin . register ( "page" , AjaxPagePlugin ) ;
8889 } ;
8990
9091 scope . Sync . prototype = {
174175
175176 EventDispatcher . prototype . apply ( scope . Sync . prototype ) ;
176177
177- } ) ( window . StrandLib = window . StrandLib || { } ) ;
178- </ script >
178+ } ) ( window . StrandLib = window . StrandLib || { } ) ;
179+ </ script >
0 commit comments