-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathindex.js
More file actions
1144 lines (977 loc) · 32.3 KB
/
index.js
File metadata and controls
1144 lines (977 loc) · 32.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* @file js-native 通信管理
* @author errorrik(errorrik@gmail.com)
* @author houyu(785798835@qq.com)
*/
(function (root) {
/**
* 对数组进行遍历
*
* @inner
* @param {Array} array 要遍历的数组
* @param {Function} fn 遍历函数
*/
function each(array, fn) {
var len = array && array.length || 0;
for (var i = 0, l = len; i < l; i++) {
if (fn(array[i], i) === false) {
break;
}
}
}
/**
* 返回原值的方法,调用过程的兜底处理函数
*
* @inner
* @param {*} source 原值
* @return {*}
*/
function returnRaw(source) {
return source;
}
/**
* 对返回值进行 JSON 解码(反序列化)处理的函数
*
* @inner
* @param {*} source 原值
* @return {*}
*/
function returnJSONDecode(source) {
return typeof source === 'string' ? JSON.parse(source) : source;
}
/**
* 参数检查,错误直接抛出异常
*
* @inner
* @param {Array} args 调用参数
* @param {Array} declarations 参数声明列表
*/
function checkArgs(args, declarations, apiContainer) {
each(declarations, function (declaration, i) {
var errorMsg;
var value = normalizeValueDeclaration(declaration.value);
switch (checkValue(args[i], value)) {
case 1:
errorMsg = ' is required.';
break;
case 2:
errorMsg = ' type error. must be ' + JSON.stringify(value.type || 'Array');
break;
case 3:
errorMsg = ' type error, must be oneOf ' + JSON.stringify(value.oneOf);
break;
case 4:
errorMsg = ' type error, must be oneOfType ' + JSON.stringify(value.oneOfType);
break;
case 5:
errorMsg = ' type error, must be arrayOf ' + JSON.stringify(value.arrayOf);
break;
}
if (errorMsg) {
var title = apiContainer && apiContainer.options.errorTitle || 'jsNative';
throw new Error('[' + title + ' Argument Error]' + declaration.name + errorMsg);
}
});
}
/**
* 对值声明进行标准化处理
*
* @inner
* @param {Object|string} declaration 值声明
* @return {Object}
*/
function normalizeValueDeclaration(declaration) {
if (typeof declaration === 'string') {
var realDeclaration = {isRequired: true};
if (/=$/.test(declaration)) {
realDeclaration.isRequired = false;
declaration = declaration.slice(0, declaration.length - 1);
}
if (/\[\]$/.test(declaration)) {
realDeclaration.arrayOf = declaration.slice(0, declaration.length - 2);
}
else if (declaration.indexOf('|') > 0) {
realDeclaration.oneOfType = declaration.split('|');
}
else {
realDeclaration.type = declaration;
}
return realDeclaration;
}
return declaration;
}
/**
* 对参数值进行检查
*
* @inner
* @param {*} value 值
* @param {Object} declaration 值声明
* @return {number}
*/
function checkValue(value, declaration) {
declaration = normalizeValueDeclaration(declaration);
if (value == null) {
return declaration.isRequired && declaration.type !== '*' ? 1 : 0;
}
var valid = false;
switch (typeof declaration.type) {
case 'string':
switch (declaration.type) {
case 'string':
case 'boolean':
case 'number':
case 'function':
case 'object':
valid = typeof value === declaration.type;
break;
case 'Object':
valid = typeof value === 'object';
break;
case 'Array':
valid = value instanceof Array;
break;
case '*':
valid = true;
break;
}
if (!valid) {
return 2;
}
break;
case 'object':
if (value && typeof value === 'object') {
valid = true;
for (var key in declaration.type) {
valid = !checkValue(value[key], declaration.type[key]);
if (!valid) {
break;
}
}
}
if (!valid) {
return 2;
}
break;
default:
if (declaration.oneOf) {
each(declaration.oneOf, function (expectValue) {
valid = expectValue === value;
return !valid;
});
if (!valid) {
return 3;
}
}
else if (declaration.oneOfType) {
each(declaration.oneOfType, function (expectType) {
valid = !checkValue(value, expectType);
return !valid;
});
if (!valid) {
return 4;
}
}
else if (declaration.arrayOf) {
if (value instanceof Array) {
valid = true;
each(value, function (item) {
return (valid = !checkValue(item, declaration.arrayOf));
});
if (!valid) {
return 5;
}
}
else {
return 2;
}
}
}
return 0;
}
/**
* 对调用参数中的所有回调函数,进行参数解码(反序列化)包装
*
* @inner
* @param {Array} args 调用参数
* @return {Array}
*/
function wrapDecodeFuncArgs(args) {
each(args, function (arg, i) {
if (typeof arg === 'function') {
args[i] = wrapDecodeFuncArg(arg);
}
});
return args;
}
/**
* 对回调函数的参数进行解码(反序列化)包装
*
* @inner
* @param {Function} fn 回调函数
* @return {Function}
*/
function wrapDecodeFuncArg(fn) {
return function (arg) {
fn(typeof arg === 'string' ? JSON.parse(arg) : arg);
};
}
/**
* 对调用参数中的所有回调函数,进行序列化包装
*
* @inner
* @param {Array} args 调用参数
* @return {Array}
*/
function wrapArgFunc(args) {
each(args, function (arg, i) {
if (typeof arg === 'function') {
args[i] = wrapFunc(arg);
}
});
return args;
}
/**
* 用于回调函数包装命名的自增id
*
* @inner
* @type {number}
*/
var funcId = 1;
/**
* 用于回调函数包装命名的前缀
*
* @inner
* @const
* @type {string}
*/
var FUNC_PREFIX = '__jsna_';
/**
* 对回调函数,进行序列化包装
*
* @inner
* @param {Function} fn 回调函数
* @return {string}
*/
function wrapFunc(fn) {
var funcName = FUNC_PREFIX + (funcId++);
root[funcName] = function (arg) {
delete root[funcName];
fn(arg);
};
return funcName;
}
/**
* 对调用参数中的所有参数进行JSON序列化
*
* @inner
* @param {Array} args 调用参数
* @return {Array}
*/
function argJSONEncode(args) {
each(args, function (arg, i) {
args[i] = JSON.stringify(arg);
});
return args;
}
/**
* 将调用参数合并成对象
*
* @inner
* @param {Array} args 调用参数
* @param {Array} declarations 参数声明列表
* @return {Object}
*/
function argCombine(args, declarations) {
var result = {};
each(declarations, function (declaration, i) {
var arg = args[i];
if (arg != null) {
result[declaration.name] = arg;
}
});
return result;
}
/**
* 通过 prompt 对话框进行 Native 调用
*
* @inner
* @param {string} source 要传递的数据字符串
* @return {string}
*/
function callPrompt(source) {
return root.prompt(source);
}
/**
* 通过 location.href 进行 Native 调用
*
* @inner
* @param {string} url 要传递的url字符串
*/
function callLocation(url) {
root.location.href = url;
}
/**
* 通过 iframe 进行 Native 调用
*
* @inner
* @param {string} url 要传递的url字符串
*/
function callIframe(url) {
var iframe = document.createElement('iframe');
iframe.src = url;
document.body.appendChild(iframe);
document.body.removeChild(iframe);
}
/**
* 映射调用对象描述中的名称
*
* @inner
* @param {Object|Function} mapAPI 调用描述对象名称的映射表或映射函数
* @param {string} name 调用描述对象中的名称
* @return {string}
*/
function mapAPIName(mapAPI, name) {
if (typeof mapAPI === 'function') {
return mapAPI(name);
}
return mapAPI[name];
}
/**
* 调用描述对象的 invoke 属性为字符串时的快捷映射表
*
* @inner
* @const
* @type {Object}
*/
var INVOKE_SHORTCUT = {
'method': [
'ArgCheck',
'CallMethod'
],
'method.json': [
'ArgCheck',
'ArgFuncArgDecode:JSON',
'ArgFuncEncode',
'ArgEncode:JSON',
'CallMethod',
'ReturnDecode:JSON'
],
'prompt.json': [
'ArgCheck',
'ArgFuncArgDecode:JSON',
'ArgFuncEncode',
'ArgAdd:name',
'ArgCombine:JSONString',
'CallPrompt',
'ReturnDecode:JSON'
],
'prompt.url': [
'ArgCheck',
'ArgFuncArgDecode:JSON',
'ArgFuncEncode',
'ArgEncode:JSON',
'ArgCombine:URL',
'CallPrompt',
'ReturnDecode:JSON'
],
'location': [
'ArgCheck',
'ArgFuncArgDecode:JSON',
'ArgFuncEncode',
'ArgEncode:JSON',
'ArgCombine:URL',
'CallLocation'
],
'iframe': [
'ArgCheck',
'ArgFuncArgDecode:JSON',
'ArgFuncEncode',
'ArgEncode:JSON',
'ArgCombine:URL',
'CallIframe'
],
'message': [
'ArgCheck',
'ArgFuncArgDecode:JSON',
'ArgFuncEncode',
'ArgAdd:name',
'ArgCombine:Object',
'CallMessage'
]
};
/**
* 调用描述对象的 invoke 属性为 Object时,call 字段对应的映射表
*
* @inner
* @const
* @type {Object}
*/
var INVOKE_CALL_MAP = {
method: 'CallMethod',
prompt: 'CallPrompt',
location: 'CallLocation',
iframe: 'CallIframe',
message: 'CallMessage'
};
/**
* 调用描述对象的 invoke 属性为 Object时,before 字段对应的映射表
*
* @inner
* @const
* @type {Object}
*/
var INVOKE_BEFORE_MAP = {
JSONStringInTurn: [
'ArgFuncArgDecode:JSON',
'ArgFuncEncode',
'ArgEncode:JSON'
],
JSONString: [
'ArgFuncArgDecode:JSON',
'ArgFuncEncode',
'ArgAdd:name',
'ArgCombine:JSONString'
],
JSONObject: [
'ArgFuncArgDecode:JSON',
'ArgFuncEncode',
'ArgAdd:name',
'ArgCombine:Object'
],
URL: [
'ArgFuncArgDecode:JSON',
'ArgFuncEncode',
'ArgEncode:JSON',
'ArgCombine:URL'
]
};
var BUILTIN_DESCRIPTION_PROPS = {
name: 1,
args: 1,
invoke: 1,
method: 1,
scheme: 1,
authority: 1,
path: 1,
handler: 1
};
function descriptionPropMerger(target, source) {
for (var key in source) {
if (source.hasOwnProperty(key) && !BUILTIN_DESCRIPTION_PROPS[key]) {
target[key] = source[key];
}
}
return target;
}
/**
* 对调用描述对象进行标准化处理
*
* @inner
* @param {Object} description 调用描述对象
* @param {Function?} propMerger 属性合并方法,默认实现为for...in,APIContainer可用于提升性能
* @return {Object}
*/
function normalizeDescription(description, propMerger) {
var args = [];
if (description.args instanceof Array) {
for (var i = 0; i < description.args.length; i++) {
var arg = description.args[i];
args.push({
name: arg.name || arg.n,
value: arg.value || arg.v
});
}
}
propMerger = propMerger || descriptionPropMerger;
return propMerger(
{
name: description.name,
args: args,
invoke: normalizeInvoke(description.invoke),
method: description.method,
scheme: description.scheme || description.schema,
authority: description.authority,
path: description.path,
handler: description.handler
},
description
);
}
/**
* 对 description 中的 invoke 属性进行标准化处理
*
* @inner
* @param {Array|Object|string} invoke description的invoke属性
* @return {Array?}
*/
function normalizeInvoke(invoke) {
if (invoke instanceof Array) {
return invoke;
}
switch (typeof invoke) {
case 'string':
return INVOKE_SHORTCUT[invoke];
case 'object':
var result = [];
if (invoke.check) {
result.push('ArgCheck');
}
if (invoke.before) {
result = result.concat(INVOKE_BEFORE_MAP[invoke.before]);
}
result.push(INVOKE_CALL_MAP[invoke.call]);
if (invoke.after === 'JSON') {
result.push('ReturnDecode:JSON');
}
return result;
}
}
function APIContainer(options) {
/**
* processor 创建方法集合
*
* @inner
* @type {Object}
*/
var processorCreators = {
/**
* 创建参数检查处理函数
*
* @param {Object} description 调用描述对象
* @return {Function}
*/
ArgCheck: function (description, option, apiContainer) {
return function (args) {
checkArgs(args, description.args, apiContainer);
return args;
};
},
/**
* 创建解码回调函数参数包装的处理函数
*
* @param {Object} description 调用描述对象
* @param {string} option 处理参数
* @return {Function}
*/
ArgFuncArgDecode: function (description, option) {
return option === 'JSON'
? wrapDecodeFuncArgs
: returnRaw;
},
/**
* 创建回调函数序列化的处理函数
*
* @return {Function}
*/
ArgFuncEncode: function () {
return wrapArgFunc;
},
/**
* 创建参数序列化的处理函数
*
* @param {Object} description 调用描述对象
* @param {string} option 处理参数
* @return {Function}
*/
ArgEncode: function (description, option) {
return option === 'JSON'
? argJSONEncode
: returnRaw;
},
/**
* 创建从调用描述对象中添加额外参数的处理函数
*
* @param {Object} description 调用描述对象
* @param {string} option 处理参数
* @return {Function}
*/
ArgAdd: function (description, option) {
var argLen = description.args.length;
description.args.push({
name: '_' + option,
value: '*'
});
var value = description[option];
return function (args) {
args[argLen] = value;
return args;
};
},
/**
* 创建参数合并的处理函数
*
* @param {Object} description 调用描述对象
* @param {string} option 处理参数
* @return {Function}
*/
ArgCombine: function (description, option) {
switch (option) {
case 'URL':
var prefix = description.scheme + '://' + description.authority + description.path;
return function (args) {
var result = [];
each(description.args, function (declaration, i) {
var arg = args[i];
if (arg != null) {
result.push(declaration.name + '=' + encodeURIComponent(arg));
}
});
var queryStr = result.join('&');
return queryStr ? prefix + '?' + queryStr : prefix;
};
case 'Object':
return function (args) {
return argCombine(args, description.args);
};
case 'JSONString':
return function (args) {
return JSON.stringify(argCombine(args, description.args));
};
}
return returnRaw;
},
/**
* 创建方法调用的处理函数
*
* @param {Object} description 调用描述对象
* @param {string} option 处理参数
* @return {Function}
*/
CallMethod: function (description, option) {
var methodOwner;
var methodName;
function findMethod() {
if (!methodOwner) {
var segs = description.method.split('.');
var lastIndex = segs.length - 1;
methodName = segs[lastIndex];
methodOwner = root;
for (var i = 0; i < lastIndex; i++) {
methodOwner = methodOwner[segs[i]];
}
}
}
return function (args) {
findMethod();
switch (description.args.length) {
case 0:
return methodOwner[methodName]();
case 1:
return methodOwner[methodName](args[0]);
case 2:
return methodOwner[methodName](args[0], args[1]);
case 3:
return methodOwner[methodName](args[0], args[1], args[2]);
}
return methodOwner[methodName].apply(methodOwner, args);
};
},
/**
* 创建 prompt 调用的处理函数
*
* @return {Function}
*/
CallPrompt: function () {
return callPrompt;
},
/**
* 创建 iframe 调用的处理函数
*
* @return {Function}
*/
CallIframe: function () {
return callIframe;
},
/**
* 创建 location 调用的处理函数
*
* @return {Function}
*/
CallLocation: function () {
return callLocation;
},
/**
* 创建 postMessage 调用的处理函数
*
* @param {Object} description 调用描述对象
* @return {Function}
*/
CallMessage: function (description) {
return function (args) {
root.webkit.messageHandlers[description.handler].postMessage(args);
};
},
/**
* 创建对返回值进行解码的处理函数
*
* @param {Object} description 调用描述对象
* @param {string} option 处理参数
* @return {Function}
*/
ReturnDecode: function (description, option) {
return option === 'JSON'
? returnJSONDecode
: returnRaw;
}
};
var apiContainer = {
options: {
errorTitle: 'jsNative',
namingConflict: 'error'
},
apis: [],
apisLen: 0,
apiIndex: {},
/**
* 配置参数,设置的参数将被合并到现有参数中
*
* @param {Object} options 参数对象
* @param {string=} options.errorTitle 显示报错信息的标题
* @param {string=} options.namingConflict 名字冲突时的处理策略
* @return {APIContainer}
*/
config: function (options) {
options = options || {};
// 再多就不能这么干了
this.options.errorTitle = options.errorTitle || this.options.errorTitle;
this.options.namingConflict = options.namingConflict || this.options.namingConflict;
return this;
},
/**
* 添加调用API
*
* @param {Object|Array} description 调用描述对象
* @return {APIContainer}
*/
add: function (description) {
if (description instanceof Array) {
for (var i = 0; i < description.length; i++) {
this.add(description[i]);
}
}
else if (typeof description === 'object') {
var name = description.name;
if (this.apiIndex[name] != null) {
switch (this.options.namingConflict) {
/* jshint ignore:start */
case 'override':
this.apis[this.apiIndex[name]] = normalizeDescription(
description,
this.descriptionPropMerger
);
case 'ignore':
break;
/* jshint ignore:end */
case 'error':
default:
throw new Error('[' + this.options.errorTitle + '] API exists: ' + name);
}
}
else {
var realDesc = normalizeDescription(description, this.descriptionPropMerger);
this.apiIndex[name] = this.apisLen;
this.apis[this.apisLen++] = realDesc;
}
}
return this;
},
/**
* 从一次 Native 的调用结果中添加调用API
*
* @param {Object} description 调用描述对象
* @return {APIContainer}
*/
fromNative: function (description) {
return this.add(invokeDescription(normalizeDescription(description, this.descriptionPropMerger)));
},
/**
* 通过描述对象的 name 属性进行调用
*
* @param {string} name 调用描述对象名
* @param {Array=} args 调用参数
* @return {*}
*/
invoke: function (name, args) {
return invokeDescription(this.apis[this.apiIndex[name]], args);
},
/**
* 生成一个对象,其上的方法是 API 容器对象中调用描述对象编译成的,可被直接调用的函数
*
* @param {Object|Function} mapAPI 调用描述对象名称的映射表或映射函数
* @return {Object}
*/
map: function (mapAPI) {
mapAPI = mapAPI || function (name) {
return name;
};
var apiObject = {};
for (var i = 0; i < this.apis.length; i++) {
var api = this.apis[i];
var apiName = mapAPIName(mapAPI, api.name);
if (apiName && api.invoke) {
if (apiName.indexOf('.') > 0) {
var apiNameSegs = apiName.split('.');
var j = 0;
var ns = apiObject;
for (; j < apiNameSegs.length - 1; j++) {
var seg = apiNameSegs[j];
ns[seg] = ns[seg] || {};
ns = ns[seg];
// 无聊留个精简写法
// ns = ns[apiNameSegs[j]] = ns[apiNameSegs[j]] || {};
}
ns[apiNameSegs[j]] = buildAPIMethod(api, this);
}
else {
apiObject[apiName] = buildAPIMethod(api, this);
}
}
}
return apiObject;
},
/**
* 通过调用描述对象进行调用
*
* @param {Object} description 调用描述对象
* @param {Array} args 调用参数
* @return {*}
*/
invokeAPI: function (description, args) {
return invokeDescription(normalizeDescription(description, this.descriptionPropMerger), args);
},
/**
* 开发者补充processorsCreators的自定义集(TIPS:不能刷掉内置的processorCreators)
*
* @param {string} name 注册的processorCreator名称
* @param {Function} 需要注册的processorCreator,此函数返回值需要是一个函数
* @return {APIContainer}
*/
addProcessorCreator: function (name, processorCreator) {
if (processorCreators[name]) {
throw new Error('[' + this.options.errorTitle + '] processorCreators exists: ' + name);
}
processorCreators[name] = processorCreator;
return this;
},
/**
* 设置 description 额外的属性列表
* 若设置了description 额外的属性列表,不在列表中的属性将被忽略