siphon plugins into .plugins namespace (#184)

This commit is contained in:
Josh de Leeuw 2016-01-05 10:16:58 -05:00
parent fbc1fa2a9c
commit 77a29acfd7
26 changed files with 196 additions and 194 deletions

View File

@ -7,7 +7,7 @@ Creating new plugins is the way to add new kinds of tasks to jsPsych. A task can
Plugin files follow a specific template. Adherence to the template is what allows jsPsych to run a plugin without knowing anything about what the plugin is doing. What makes plugins so flexible is that the template imposes very few requirements on the code. Here's what an empty plugin template looks like: Plugin files follow a specific template. Adherence to the template is what allows jsPsych to run a plugin without knowing anything about what the plugin is doing. What makes plugins so flexible is that the template imposes very few requirements on the code. Here's what an empty plugin template looks like:
``` ```
jsPsych['plugin-name'] = (function(){ jsPsych.plugins['plugin-name'] = (function(){
var plugin = {}; var plugin = {};

View File

@ -263,7 +263,7 @@ var jsPsych = (function() {
var trial_type = parameters.type; var trial_type = parameters.type;
if (typeof trial_type == 'undefined') { if (typeof trial_type == 'undefined') {
console.error('Trial level node is missing the "type" parameter. The parameters for the node are: ' + JSON.stringify(parameters)); console.error('Trial level node is missing the "type" parameter. The parameters for the node are: ' + JSON.stringify(parameters));
} else if (typeof jsPsych[trial_type] == 'undefined') { } else if (typeof jsPsych.plugins[trial_type] == 'undefined') {
console.error('No plugin loaded for trials of type "' + trial_type + '"'); console.error('No plugin loaded for trials of type "' + trial_type + '"');
} }
// create a deep copy of the parameters for the trial // create a deep copy of the parameters for the trial
@ -555,7 +555,7 @@ var jsPsych = (function() {
opts.on_trial_start(); opts.on_trial_start();
// execute trial method // execute trial method
jsPsych[trial.type].trial(DOM_target, trial); jsPsych.plugins[trial.type].trial(DOM_target, trial);
} }
function drawProgressBar() { function drawProgressBar() {
@ -576,6 +576,8 @@ var jsPsych = (function() {
return core; return core;
})(); })();
jsPsych.plugins = {};
jsPsych.data = (function() { jsPsych.data = (function() {
var module = {}; var module = {};

View File

@ -5,7 +5,7 @@
* documentation: docs.jspsych.org * documentation: docs.jspsych.org
*/ */
jsPsych.animation = (function() { jsPsych.plugins.animation = (function() {
var plugin = {}; var plugin = {};

View File

@ -8,7 +8,7 @@
* *
**/ **/
jsPsych["button-response"] = (function() { jsPsych.plugins["button-response"] = (function() {
var plugin = {}; var plugin = {};

View File

@ -7,7 +7,7 @@
* *
**/ **/
jsPsych['call-function'] = (function() { jsPsych.plugins['call-function'] = (function() {
var plugin = {}; var plugin = {};

View File

@ -6,7 +6,7 @@
**/ **/
jsPsych["categorize-animation"] = (function() { jsPsych.plugins["categorize-animation"] = (function() {
var plugin = {}; var plugin = {};

View File

@ -6,7 +6,7 @@
**/ **/
jsPsych.categorize = (function() { jsPsych.plugins.categorize = (function() {
var plugin = {}; var plugin = {};

View File

@ -7,7 +7,7 @@
*/ */
jsPsych['free-sort'] = (function() { jsPsych.plugins['free-sort'] = (function() {
var plugin = {}; var plugin = {};

View File

@ -6,7 +6,7 @@ the plugin will wait of a specified time before it proceeds.
documentation: docs.jspsych.org documentation: docs.jspsych.org
*/ */
jsPsych.html = (function() { jsPsych.plugins.html = (function() {
var plugin = {}; var plugin = {};

View File

@ -9,7 +9,7 @@
* *
*/ */
jsPsych.instructions = (function() { jsPsych.plugins.instructions = (function() {
var plugin = {}; var plugin = {};

View File

@ -10,7 +10,7 @@
**/ **/
jsPsych["multi-stim-multi-response"] = (function() { jsPsych.plugins["multi-stim-multi-response"] = (function() {
var plugin = {}; var plugin = {};

View File

@ -16,7 +16,7 @@
*/ */
jsPsych.palmer = (function() { jsPsych.plugins.palmer = (function() {
var plugin = {}; var plugin = {};

View File

@ -10,7 +10,7 @@
*/ */
jsPsych['reconstruction'] = (function() { jsPsych.plugins['reconstruction'] = (function() {
var plugin = {}; var plugin = {};

View File

@ -8,7 +8,7 @@
* *
*/ */
jsPsych['same-different'] = (function() { jsPsych.plugins['same-different'] = (function() {
var plugin = {}; var plugin = {};

View File

@ -9,7 +9,7 @@
*/ */
jsPsych.similarity = (function() { jsPsych.plugins.similarity = (function() {
var plugin = {}; var plugin = {};

View File

@ -8,7 +8,7 @@
* *
**/ **/
jsPsych["single-audio"] = (function() { jsPsych.plugins["single-audio"] = (function() {
var plugin = {}; var plugin = {};

View File

@ -9,7 +9,7 @@
**/ **/
jsPsych["single-stim"] = (function() { jsPsych.plugins["single-stim"] = (function() {
var plugin = {}; var plugin = {};

View File

@ -8,7 +8,7 @@
* *
*/ */
jsPsych['survey-likert'] = (function() { jsPsych.plugins['survey-likert'] = (function() {
var plugin = {}; var plugin = {};

View File

@ -9,7 +9,7 @@
*/ */
jsPsych['survey-multi-choice'] = (function() { jsPsych.plugins['survey-multi-choice'] = (function() {
var plugin = {}; var plugin = {};

View File

@ -9,7 +9,7 @@
*/ */
jsPsych['survey-text'] = (function() { jsPsych.plugins['survey-text'] = (function() {
var plugin = {}; var plugin = {};

View File

@ -9,7 +9,7 @@
* *
*/ */
jsPsych.text = (function() { jsPsych.plugins.text = (function() {
var plugin = {}; var plugin = {};

View File

@ -14,7 +14,7 @@
* *
**/ **/
jsPsych["visual-search-circle"] = (function() { jsPsych.plugins["visual-search-circle"] = (function() {
var plugin = {}; var plugin = {};

View File

@ -11,7 +11,7 @@
* *
*/ */
jsPsych['vsl-animate-occlusion'] = (function() { jsPsych.plugins['vsl-animate-occlusion'] = (function() {
var plugin = {}; var plugin = {};

View File

@ -11,7 +11,7 @@
* *
*/ */
jsPsych['vsl-grid-scene'] = (function() { jsPsych.plugins['vsl-grid-scene'] = (function() {
var plugin = {}; var plugin = {};

View File

@ -8,7 +8,7 @@
* *
*/ */
jsPsych.xab = (function() { jsPsych.plugins.xab = (function() {
var plugin = {}; var plugin = {};

View File

@ -2,7 +2,7 @@
* Example plugin template * Example plugin template
*/ */
jsPsych["PLUGIN-NAME"] = (function() { jsPsych.plugins["PLUGIN-NAME"] = (function() {
var plugin = {}; var plugin = {};