Alyssa Rosenzweig 7cea452997 Move everything up one 7 سال پیش
..
account_course_user_search 7cea452997 Move everything up one 7 سال پیش
actAs 7cea452997 Move everything up one 7 سال پیش
add_people 7cea452997 Move everything up one 7 سال پیش
announcements 7cea452997 Move everything up one 7 سال پیش
assignments 7cea452997 Move everything up one 7 سال پیش
authentication_providers 7cea452997 Move everything up one 7 سال پیش
blueprint_courses 7cea452997 Move everything up one 7 سال پیش
bundles 7cea452997 Move everything up one 7 سال پیش
calendar 7cea452997 Move everything up one 7 سال پیش
canvas_cropper 7cea452997 Move everything up one 7 سال پیش
choose_mastery_path 7cea452997 Move everything up one 7 سال پیش
collaborations 7cea452997 Move everything up one 7 سال پیش
conditional_release_stats 7cea452997 Move everything up one 7 سال پیش
context_cards 7cea452997 Move everything up one 7 سال پیش
context_modules 7cea452997 Move everything up one 7 سال پیش
course_link_validator 7cea452997 Move everything up one 7 سال پیش
course_settings 7cea452997 Move everything up one 7 سال پیش
course_wizard 7cea452997 Move everything up one 7 سال پیش
courses 7cea452997 Move everything up one 7 سال پیش
custom_help_link_settings 7cea452997 Move everything up one 7 سال پیش
dashboard 7cea452997 Move everything up one 7 سال پیش
dashboard_card 7cea452997 Move everything up one 7 سال پیش
discussion_topics 7cea452997 Move everything up one 7 سال پیش
due_dates 7cea452997 Move everything up one 7 سال پیش
editor 7cea452997 Move everything up one 7 سال پیش
eportfolios 7cea452997 Move everything up one 7 سال پیش
epub_exports 7cea452997 Move everything up one 7 سال پیش
external_apps 7cea452997 Move everything up one 7 سال پیش
files 7cea452997 Move everything up one 7 سال پیش
gradebook 7cea452997 Move everything up one 7 سال پیش
gradebook-history 7cea452997 Move everything up one 7 سال پیش
gradezilla 7cea452997 Move everything up one 7 سال پیش
grading 7cea452997 Move everything up one 7 سال پیش
groups 7cea452997 Move everything up one 7 سال پیش
help_dialog 7cea452997 Move everything up one 7 سال پیش
mediaelement 7cea452997 Move everything up one 7 سال پیش
move_item 7cea452997 Move everything up one 7 سال پیش
navigation_header 7cea452997 Move everything up one 7 سال پیش
new_user_tutorial 7cea452997 Move everything up one 7 سال پیش
notification_preferences 7cea452997 Move everything up one 7 سال پیش
outcomes 7cea452997 Move everything up one 7 سال پیش
quizzes 7cea452997 Move everything up one 7 سال پیش
rubrics 7cea452997 Move everything up one 7 سال پیش
shared 7cea452997 Move everything up one 7 سال پیش
speed_grader 7cea452997 Move everything up one 7 سال پیش
styleguide 7cea452997 Move everything up one 7 سال پیش
theme_editor 7cea452997 Move everything up one 7 سال پیش
webzip_export 7cea452997 Move everything up one 7 سال پیش
README.md 7cea452997 Move everything up one 7 سال پیش
appBootstrap.js 7cea452997 Move everything up one 7 سال پیش
canvasCssVariablesPolyfill.js 7cea452997 Move everything up one 7 سال پیش
railsFlashNotificationsHelper.js 7cea452997 Move everything up one 7 سال پیش

README.md

This directory is temporary until we rework the front-end build This is where we are headed.

Stuff you can do in Canvas JSX files

BUT WAIT!

Your file needs to:

  1. Have a file name with the .jsx extension.

JSX

function foo(paths) {
  return <svg>{paths}</svg>;
}

Arrow Functions

Arrow Function Reference

var arr = ['hydrogen', 'helium', 'lithium'];

// es5
var a = arr.map(function(s){ return s.length });

// es6
var b = arr.map( s => s.length );

// with curlies requires normal return
var b = arr.map( (s) => {
  return s.length
});

// lexical `this`
var obj = {
  multiplier: 3,

  multiplyStuff (stuff) {
    return stuff.map((x) =>
      // no bind!
      return this.multiplier * x;
    )
  }
};

Classes

Class Reference

class EventEmitter {
  constructor() {
    // called when created
  }
  emit() {
    // ...
  }
  on() {
    // ...
  }
  once() {
    // ...
  }
  removeListener() {
    // ...
  }
  removeAllListeners() {
    // ...
  }
}

Extending and calling super.

class Domain extends EventEmitter {
  constructor() {
    super();
    this.members = [];
  }
}

Creating instances

var domain = new Domain();

Destructuring

// es5
var map = _.map;
var each = _.each;

// es6
var {map, each} = _;

Concise Object Methods

// es5
var obj = {
  foo: function() {}
  bar: function() {}
};

// es6
var obj = {
  foo() {}
  bar() {}
};

Object Short Notation

// es5
function() {
  // ...
  return {foo: foo, bar: bar, x: 10};
}

// es6
function() {
  // ...
  return {foo, bar, x: 10};
}

Rest Parameters

Rest Parameters Reference

// es5
function multiply(multiplier) {
  var numbers = Array.prototype.slice.call(arguments, 0);
  return number.map(function(n) { return multiplier * n; });
}

// es6
function multiply(multiplier, ...numbers) {
  return numbers.map( n => multiplier * n);
}

String Templates

String Template Reference

Multiline strings:

// es5
console.log("string text line 1" +
"string text line 2");

// es6
console.log(`string text line 1
string text line 2`);

Interpolated strings

var a = 5;
var b = 10;

// es5
console.log("Fifteen is " + (a + b) + " and not " + (2 * a + b) + ".");

// es6
console.log(`Fifteen is ${a + b} and not ${2 * a + b}.`);