Pregunta

What is defining the exports module in the following snippet?

define(["require", "exports", 'durandal/app', 'durandal/http'], function(require, exports, __app__, __http__) {
.
.
.
}

I checked out this example, opened the solution and couldn't figure out whatever is defining the "exports" module. Is that just native to RequireJS now, or is there an external reference that I'm still missing?

¿Fue útil?

Solución

Ass soon as you import anything in typescript and compile with amd you get a define with require and exports.

exports is requireJS handle for anything you want to export from this module. e.g.

export var foo = 123; 

will generate

exports.foo = 123;

Which is utilized by requirejs import on the other end.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top