Wrap generated JavaScript in a function definition.