mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Implement App.appendToConfig
This commit is contained in:
committed by
Zoltan Olah
parent
8bdbcb7199
commit
3797ab014e
30
tools/cordova/builder.js
vendored
30
tools/cordova/builder.js
vendored
@@ -104,6 +104,9 @@ export class CordovaBuilder {
|
||||
}
|
||||
};
|
||||
|
||||
// Custom elements that will be appended into config.xml's widgets
|
||||
this.custom = [];
|
||||
|
||||
const packageMap = this.projectContext.packageMap;
|
||||
|
||||
if (packageMap && packageMap.getInfo('launch-screen')) {
|
||||
@@ -250,6 +253,17 @@ export class CordovaBuilder {
|
||||
});
|
||||
});
|
||||
|
||||
// Set custom tags into widget element
|
||||
_.each(this.custom, elementSet => {
|
||||
let tag = config
|
||||
.element(elementSet.name, elementSet.contents.attrs);
|
||||
|
||||
_.each(elementSet.contents.children, child => {
|
||||
tag.element(child.name, child.attrs);
|
||||
if(child.txt) tag.txt(child.txt);
|
||||
});
|
||||
});
|
||||
|
||||
config.element('content', { src: this.metadata.contentUrl });
|
||||
|
||||
// Copy all the access rules
|
||||
@@ -628,6 +642,22 @@ configuration. The key may be deprecated.`);
|
||||
}
|
||||
|
||||
builder.accessRules[pattern] = options;
|
||||
},
|
||||
|
||||
/**
|
||||
* @summary Append custom tags into config's widget element.
|
||||
*
|
||||
* `App.appendToConfig('custom-tag', {attrs: '', children: {}});`
|
||||
*
|
||||
* @param {String} elementName The tag name
|
||||
* @param {Object} contents The contents
|
||||
* @memberOf App
|
||||
*/
|
||||
appendToConfig: function (name, contents) {
|
||||
builder.custom.push({
|
||||
name,
|
||||
contents
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user