主要功能: - 修改RequirementModal支持12个订单班选择 - 添加OrderClassIconMap图标映射组件 - Store中添加selectedOrderClass状态管理 - WorkflowPage支持传递orderClass参数 - web_result添加URL参数切换功能 - 创建order-class-handler.js动态处理页面主题 技术改进: - 创建软链接关联订单班数据目录 - 生成wenlu.json和food.json数据结构 - 删除重复的web_result目录 - 添加测试页面test-order-class.html 影响范围: - 展会策划系统现支持12个订单班 - 结果展示页面自动适配不同订单班主题 - 用户可选择不同行业生成对应方案 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
79 lines
2.5 KiB
JavaScript
79 lines
2.5 KiB
JavaScript
"use strict"
|
|
// global key for user preferred registration
|
|
var REGISTRATION_KEY = '@@any-promise/REGISTRATION',
|
|
// Prior registration (preferred or detected)
|
|
registered = null
|
|
|
|
/**
|
|
* Registers the given implementation. An implementation must
|
|
* be registered prior to any call to `require("any-promise")`,
|
|
* typically on application load.
|
|
*
|
|
* If called with no arguments, will return registration in
|
|
* following priority:
|
|
*
|
|
* For Node.js:
|
|
*
|
|
* 1. Previous registration
|
|
* 2. global.Promise if node.js version >= 0.12
|
|
* 3. Auto detected promise based on first sucessful require of
|
|
* known promise libraries. Note this is a last resort, as the
|
|
* loaded library is non-deterministic. node.js >= 0.12 will
|
|
* always use global.Promise over this priority list.
|
|
* 4. Throws error.
|
|
*
|
|
* For Browser:
|
|
*
|
|
* 1. Previous registration
|
|
* 2. window.Promise
|
|
* 3. Throws error.
|
|
*
|
|
* Options:
|
|
*
|
|
* Promise: Desired Promise constructor
|
|
* global: Boolean - Should the registration be cached in a global variable to
|
|
* allow cross dependency/bundle registration? (default true)
|
|
*/
|
|
module.exports = function(root, loadImplementation){
|
|
return function register(implementation, opts){
|
|
implementation = implementation || null
|
|
opts = opts || {}
|
|
// global registration unless explicitly {global: false} in options (default true)
|
|
var registerGlobal = opts.global !== false;
|
|
|
|
// load any previous global registration
|
|
if(registered === null && registerGlobal){
|
|
registered = root[REGISTRATION_KEY] || null
|
|
}
|
|
|
|
if(registered !== null
|
|
&& implementation !== null
|
|
&& registered.implementation !== implementation){
|
|
// Throw error if attempting to redefine implementation
|
|
throw new Error('any-promise already defined as "'+registered.implementation+
|
|
'". You can only register an implementation before the first '+
|
|
' call to require("any-promise") and an implementation cannot be changed')
|
|
}
|
|
|
|
if(registered === null){
|
|
// use provided implementation
|
|
if(implementation !== null && typeof opts.Promise !== 'undefined'){
|
|
registered = {
|
|
Promise: opts.Promise,
|
|
implementation: implementation
|
|
}
|
|
} else {
|
|
// require implementation if implementation is specified but not provided
|
|
registered = loadImplementation(implementation)
|
|
}
|
|
|
|
if(registerGlobal){
|
|
// register preference globally in case multiple installations
|
|
root[REGISTRATION_KEY] = registered
|
|
}
|
|
}
|
|
|
|
return registered
|
|
}
|
|
}
|