mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Export JSON from json package.
Make sure to use the built-in JSON if it exists. Fixes #1204.
This commit is contained in:
3
packages/json/json_native.js
Normal file
3
packages/json/json_native.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// Do we already have a global JSON object? Export it as our JSON object.
|
||||
if (window.JSON)
|
||||
JSON = window.JSON;
|
||||
@@ -3,10 +3,12 @@ Package.describe({
|
||||
internal: true
|
||||
});
|
||||
|
||||
// We need to figure out how to serve this file only to browsers that
|
||||
// don't have JSON.stringify (eg, IE7 and earlier -- or is that IE8?)
|
||||
// We need to figure out how to serve this file only to browsers that don't have
|
||||
// JSON.stringify (eg, IE7 and earlier, and IE8 outside of "standards mode")
|
||||
|
||||
Package.on_use(function (api) {
|
||||
// Node always has JSON; we only need this in some browsers.
|
||||
api.export('JSON', 'client');
|
||||
api.add_files('json_native.js', 'client');
|
||||
api.add_files('json2.js', 'client');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user