-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
4,088 additions
and
1,769 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2022": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"standard", | ||
"plugin:@typescript-eslint/eslint-recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "./tsconfig.json", | ||
"ecmaFeatures": {}, | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"comma-dangle": [ | ||
"error", | ||
"always-multiline" | ||
], | ||
"camelcase": 0, | ||
"multiline-ternary": "off", | ||
"no-use-before-define": "off", | ||
"@typescript-eslint/no-use-before-define": "off", | ||
"@typescript-eslint/no-unused-vars": "error", | ||
"no-unused-vars": "off", | ||
"no-useless-constructor": "off" | ||
}, | ||
"ignorePatterns": [ | ||
"node_modules", | ||
"tests" | ||
], | ||
"settings": {} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import { Meteor } from 'meteor/meteor' | ||
import { InjectData } from './namespace' | ||
import { Meteor } from 'meteor/meteor'; | ||
import { InjectData } from './namespace'; | ||
|
||
// Automatically parse the inject-data payload on Meteor startup | ||
// Load it into memory so it can be fetched by InjectData.getData | ||
Meteor.startup(function() { | ||
var dom = document.querySelectorAll( | ||
'script[type="text/inject-data"]', | ||
document | ||
) | ||
var injectedDataString = dom && dom.length > 0 ? dom[0].innerHTML : '' | ||
InjectData._data = InjectData._decode(injectedDataString) || {} | ||
}) | ||
Meteor.startup(function () { | ||
const dom = document.querySelectorAll( | ||
'script[type="text/inject-data"]', | ||
document, | ||
); | ||
const injectedDataString = dom && dom.length > 0 ? dom[0].innerHTML : ''; | ||
InjectData._data = InjectData._decode(injectedDataString) || {}; | ||
}); | ||
|
||
/** | ||
* Returns the data payload for the specified key. | ||
* @param {string} key | ||
* @param {function} callback | ||
*/ | ||
InjectData.getData = function(key, callback) { | ||
Meteor.startup(function() { | ||
callback(InjectData._data[key]) | ||
}) | ||
} | ||
InjectData.getData = function (key, callback) { | ||
Meteor.startup(function () { | ||
callback(InjectData._data[key]); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/* global Package */ | ||
export const InjectData = {} | ||
export const InjectData = {}; | ||
|
||
// Replace communitypackages:inject-data with our new API, this is for compatibility | ||
// with third party packages that still depend upon the communitypackages version. | ||
if (Package['communitypackages:inject-data']) { | ||
Package['communitypackages:inject-data'].InjectData = InjectData | ||
// Replace meteorhacks:inject-data with our new API, this is for compatibility | ||
// with third party packages that still depend upon the meteorhacks version. | ||
if (Package['meteorhacks:inject-data']) { | ||
Package['meteorhacks:inject-data'].InjectData = InjectData; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import { EJSON } from 'meteor/ejson' | ||
import { InjectData } from './namespace' | ||
import { EJSON } from 'meteor/ejson'; | ||
import { InjectData } from './namespace'; | ||
|
||
/** | ||
* Returns an encoded string that represents an object. | ||
* @param {object} ejson | ||
*/ | ||
InjectData.encode = InjectData._encode = function(ejson) { | ||
var ejsonString = EJSON.stringify(ejson) | ||
return encodeURIComponent(ejsonString) | ||
} | ||
InjectData.encode = InjectData._encode = function (ejson) { | ||
const ejsonString = EJSON.stringify(ejson); | ||
return encodeURIComponent(ejsonString); | ||
}; | ||
|
||
/** | ||
* Decodes an encoded string into an object. | ||
* @param {string} encodedEjson | ||
*/ | ||
InjectData.decode = InjectData._decode = function(encodedEjson) { | ||
var decodedEjsonString = decodeURIComponent(encodedEjson) | ||
if (!decodedEjsonString) return null | ||
InjectData.decode = InjectData._decode = function (encodedEjson) { | ||
const decodedEjsonString = decodeURIComponent(encodedEjson); | ||
if (!decodedEjsonString) return null; | ||
|
||
return EJSON.parse(decodedEjsonString) | ||
} | ||
return EJSON.parse(decodedEjsonString); | ||
}; |
Oops, something went wrong.