From 5300488883b276cafca42fd48694a50eb0c4b847 Mon Sep 17 00:00:00 2001 From: jingsam Date: Sun, 10 Jul 2016 21:29:59 +0800 Subject: Update README.md --- platform/node/README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'platform') diff --git a/platform/node/README.md b/platform/node/README.md index 9e14d1bbd6..545d87861f 100644 --- a/platform/node/README.md +++ b/platform/node/README.md @@ -29,13 +29,25 @@ npm run test-suite ## Rendering a map tile ```js +var fs = require('fs'); +var path = require('path'); var mbgl = require('mapbox-gl-native'); var sharp = require('sharp'); -var map = new mbgl.Map({ request: function() {} }); + +var options = { + request: function(req, callback) { + fs.readFile(path.join(__dirname, 'test', req.url), function(err, data) { + callback(err, { data: data }); + }); + }, + ratio: 1 +}; + +var map = new mbgl.Map(options); map.load(require('./test/fixtures/style.json')); -map.render({}, function(err, buffer) { +map.render({zoom: 0}, function(err, buffer) { if (err) throw err; map.release(); -- cgit v1.2.1